Repository navigation
80 lines (71 loc) · 3.2 KB
/
Copy pathgithub_release.yml
File metadata and controls
80 lines (71 loc) · 3.2 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Create GitHub Release
on:
push:
tags:
- "v*" # Trigger when a version tag is pushed (e.g., v1.0.0)
jobs:
create-release:
# Snapshot tags only exist to exercise the deploy pipeline, and -antora
# tags only exist to give the docs site a corrected copy of a release.
if: ${{ !endsWith(github.ref_name, '-SNAPSHOT') && !endsWith(github.ref_name, '-antora') }}
runs-on: ubuntu-latest
permissions:
contents: write
env:
# A fine-grained token with contents write access to
# clojure-emacs/docs.cider.mx, which sending it a repository dispatch
# requires. The docs step is skipped until the secret exists.
DISPATCH_TOKEN: ${{ secrets.DOCS_DISPATCH_TOKEN }}
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# The release commit rolls the changelog before the tag is cut, so the
# tag always carries a "## X.Y.Z (date)" section for its own version.
- name: Extract the release notes from the changelog
run: |
version="${GITHUB_REF_NAME#v}"
awk -v heading="## ${version} " '
!found && index($0, heading) == 1 { found = 1; next }
found && /^## / { exit }
found { print }
' CHANGELOG.md > release-notes.md
if ! grep -q '[^[:space:]]' release-notes.md; then
echo "No changelog section found for ${version}" >&2
exit 1
fi
cat release-notes.md
# CircleCI deploys to Clojars on the same tag push, after the full test
# matrix passes. Don't announce a release that isn't there to depend on:
# wait for the artifact to show up, and fail if it never does (re-run
# this workflow once the deploy has been fixed).
- name: Wait for the artifact to land on Clojars
run: |
version="${GITHUB_REF_NAME#v}"
pom="https://repo.clojars.org/cider/cider-nrepl/${version}/cider-nrepl-${version}.pom"
for _ in $(seq 1 90); do
if curl -sfIo /dev/null "$pom"; then
echo "Found ${pom}"
exit 0
fi
sleep 30
done
echo "Gave up waiting for ${pom}" >&2
exit 1
- name: Create GitHub Release
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
with:
tag: ${{ github.ref_name }}
name: cider-nrepl ${{ github.ref_name }}
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-alpha') || contains(github.ref, '-beta') }}
bodyFile: release-notes.md
token: ${{ secrets.GITHUB_TOKEN }}
# Adds the tag to docs.cider.mx's playbook, which publishes the docs of
# the release. Prereleases leave the docs alone.
- name: Publish the docs
if: ${{ env.DISPATCH_TOKEN != '' && !contains(github.ref_name, '-') }}
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
with:
token: ${{ env.DISPATCH_TOKEN }}
repository: clojure-emacs/docs.cider.mx
event-type: release
client-payload: '{"project": "cider-nrepl", "tag": "${{ github.ref_name }}"}'