-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.62 KB
/
release.yml
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
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CI_TOKEN }}
- name: Fetch tags
run: git fetch --prune --unshallow --tags --force
- name: Get the release version from the tag
if: env.VERSION == ''
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Show the version
run: |
echo "version is: $VERSION"
- name: Check that tag version and Cargo.toml version are the same
shell: bash
run: |
cargo_version="$(echo $VERSION | sed 's/^v//')"
if ! grep -q "version = \"$cargo_version\"" Cargo.toml; then
echo "version does not match Cargo.toml" >&2
exit 1
fi
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --latest --strip all
env:
REPO_PREFIX: ${{ github.server_url }}/${{ github.repository }}/
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create $VERSION --draft --verify-tag --title $VERSION --notes "${{ steps.git-cliff.outputs.content }}"
- name: Push to CI branch
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
shell: bash
run: |
git branch -D ci-temp || true
git checkout -b ci-temp
git push -u origin ci-temp:ci --force