Files
Compass/.github/workflows/cd.yml

53 lines
1.7 KiB
YAML

name: GitHub Release
# Must select "Read and write permissions" in GitHub → Repo → Settings → Actions → General → Workflow permissions
on:
push:
branches: [main, master]
paths:
- 'package.json'
- '.github/workflows/cd.yml'
jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
released: ${{ steps.release.outputs.released }}
tag: ${{ steps.release.outputs.tag }}
steps:
- name: Checkout repo
uses: actions/checkout@master
with:
fetch-depth: 0 # To fetch all history for tags
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Tag and release
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
./scripts/release.sh
# Called directly rather than left to the `release: published` event, which GitHub does not emit for
# releases created with the default GITHUB_TOKEN. Gated on `released` so a re-run that finds the tag
# already present does not announce the same version twice.
announce:
name: Announce
needs: release
if: needs.release.outputs.released == 'true'
uses: ./.github/workflows/cd-mastodon.yml
with:
tag: ${{ needs.release.outputs.tag }}
dry_run: false
secrets:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}