Merge pull request #23 from pho3nixf1re/another-try #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tag release changeset | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
prepare: | |
name: Setup dependencies | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ env.GITHUB_TOKEN }} | |
- name: Configure git author | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
cache-dependency-path: package-lock.json | |
- name: Install dependencies | |
run: npm ci | |
- name: Check for changeset | |
run: npx changeset status --output changesets.json | |
- name: Set release output | |
id: set_release | |
run: | |
echo "hasRelease=$(jq -r '.releases | length > 0' changesets.json)" >> | |
"$GITHUB_OUTPUT" | |
- name: Rotate logs and release | |
if: ${{ steps.set_release.outputs.hasRelease == 'true' }} | |
id: release | |
run: | | |
npx changeset version | |
npx changeset tag | |
git push --follow-tags | |
echo "release=$(jq -r '.releases[0].newVersion' changesets.json)" >> $GITHUB_OUTPUT | |
- name: Create github release notes | |
if: ${{ steps.release.outputs.release != '' }} | |
run: | | |
gh release create "v${{ steps.release.outputs.release }}" --generate-notes | |
gh workflow run build-and-deploy.yml --ref "${{ steps.release.outputs.release }}" |