-
Notifications
You must be signed in to change notification settings - Fork 15
51 lines (43 loc) · 1.52 KB
/
release.yml
File metadata and controls
51 lines (43 loc) · 1.52 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
# yamllint disable rule:line-length
---
name: Release
on:
push:
tags:
- v*.*.*
permissions:
contents: read
concurrency:
group: release
cancel-in-progress: true
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Clone the repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Check embedded version numbers
run: |
version="$(grep -F "uses: ${GITHUB_REPOSITORY}@" README.md | cut -d@ -f2)"
if [[ ${version} != "${GITHUB_REF_NAME}" ]]; then
line="$(grep -Fn "uses: ${GITHUB_REPOSITORY}@" README.md | cut -d: -f1)"
printf '::error file=README.md,line=%d::version does not match tag\n' "${line}"
rc=1
fi
if [[ $(jq -r .version package.json) != "${GITHUB_REF_NAME#v}" ]]; then
line="$(grep -Fn '"version":' package.json | cut -d: -f1)"
printf '::error file=package.json,line=%d::version does not match tag\n' "${line}"
rc=1
fi
exit "${rc:-0}"
- name: Create the release
run: |
gh release create "${GITHUB_REF_NAME}" --fail-on-no-commits --generate-notes --verify-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Move the major version tag
run: |-
git tag --force --message="Release ${GITHUB_REF_NAME%%.*}" "${GITHUB_REF_NAME%%.*}" "${GITHUB_REF_NAME}^{}"
git push --force origin "${GITHUB_REF_NAME%%.*}"