Skip to content

chore: fix previous_tag #8

chore: fix previous_tag

chore: fix previous_tag #8

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install packages
run: bun i
- name: Check code coverage
run: bun run coverage
release:
# DO NOT RUN ON PR
if: github.event_name != 'pull_request'
needs: coverage
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set git email
run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Set git name
run: git config --global user.name "github-actions[bot]"
- name: Install bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install packages
run: bun i
- name: Build library and CLI
run: bun run build
- name: Get previous tag
id: previous_tag
run: |
previous_tag=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)
echo "{previous_tag}={previous_tag}" >> $GITHUB_OUTPUT
- name: Generate CHANGELOG for Github release
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ github.ref_name }}
toTag: ${{ steps.previous_tag.outputs.previous_tag }}
writeToFile: false
- name: Bump package version
run: npx standard-version --prerelease nightly
- name: Push changes
run: git push --follow-tags origin main
- name: Create Github release
uses: ncipollo/[email protected]
with:
prerelease: true
allowUpdates: true
draft: false
makeLatest: true
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
- name: Publish to NPM
run: npm run publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}