-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (87 loc) · 3.17 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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Release
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
concurrency:
group: "${{ github.workflow }}"
cancel-in-progress: true # only last step is important, which runs or doesn't
on:
workflow_dispatch: # releasing is manual as we don't want to release every time
permissions:
contents: write # to write tags
packages: write # to write tags to Docker registry
issues: write
pull-requests: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Only on main
if: |
github.ref != 'refs/heads/main'
shell: bash
run: |
echo "Only to be executed on main"
exit 1
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
show-progress: false
token: ${{ secrets.TOKEN_TO_TRIGGER_SUBSEQUENT_WORKFLOWS }}
- name: Cache dependencies
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1
env:
CACHE_NAME: cargo-cache-dependencies
with:
path: |
~/.cargo
./target
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ hashFiles('Cargo.lock') }}-cocogitto
restore-keys: |
${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ hashFiles('Cargo.lock') }}-
${{ runner.os }}-build-${{ env.CACHE_NAME }}-
- name: Set up toolchain
shell: bash
run: |
rm ${HOME}/.cargo/bin/cargo-fmt
rm ${HOME}/.cargo/bin/rust-analyzer
rm ${HOME}/.cargo/bin/rustfmt
rustup update
cargo --version
- name: Get binstall
shell: bash
run: |
cd /tmp
archive="cargo-binstall-x86_64-unknown-linux-musl.tgz"
wget "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/${archive}"
tar -xvf "./${archive}"
rm "./${archive}"
mv ./cargo-binstall ~/.cargo/bin/
- name: Install cocogitto to get the next version number
shell: bash
run: |
cargo binstall --no-confirm cocogitto --target x86_64-unknown-linux-musl --pkg-url "{ repo }/releases/download/{ version }/{ name }-{ version }-{ target }.tar.gz" --bin-dir "{ bin }" --pkg-fmt tgz
- name: Bump
shell: bash
id: release
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
cog bump --auto
VERSION="v$(cog -v get-version)"
echo "version=$VERSION" >> $GITHUB_OUTPUT
git push
- name: Generate Changelog
shell: bash
run: |
cog changelog --at ${{ steps.release.outputs.version }} > GITHUB_CHANGELOG.md
- name: Upload github release
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
with:
body_path: GITHUB_CHANGELOG.md
tag_name: ${{ steps.release.outputs.version }}
token: ${{ secrets.TOKEN_TO_TRIGGER_SUBSEQUENT_WORKFLOWS }}