-
-
Notifications
You must be signed in to change notification settings - Fork 9
65 lines (58 loc) · 2.1 KB
/
Copy pathcd.yml
File metadata and controls
65 lines (58 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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.
#
# One job per destination, so a Mastodon outage still gets the release into Discord and vice versa.
announce-mastodon:
name: Announce on Mastodon
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 }}
announce-discord:
name: Announce on Discord
needs: release
if: needs.release.outputs.released == 'true'
uses: ./.github/workflows/cd-discord.yml
with:
tag: ${{ needs.release.outputs.tag }}
dry_run: false
secrets:
DISCORD_WEBHOOK_ANNOUNCEMENTS: ${{ secrets.DISCORD_WEBHOOK_ANNOUNCEMENTS }}