Skip to content

Commit aed4971

Browse files
committed
ci: add release workflow
1 parent 9a3e67f commit aed4971

File tree

3 files changed

+214
-0
lines changed

3 files changed

+214
-0
lines changed

.github/workflows/release-plz.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release-plz
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release-plz-release:
10+
name: Release-plz release
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Install Rust toolchain
20+
uses: dtolnay/rust-toolchain@nightly
21+
- name: Run release-plz
22+
uses: release-plz/[email protected]
23+
with:
24+
command: release
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
27+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
28+
29+
release-plz-pr:
30+
name: Release-plz PR
31+
runs-on: ubuntu-latest
32+
permissions:
33+
pull-requests: write
34+
contents: write
35+
concurrency:
36+
group: release-plz-${{ github.ref }}
37+
cancel-in-progress: false
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
44+
- name: Install Rust toolchain
45+
uses: dtolnay/rust-toolchain@nightly
46+
- name: Run release-plz
47+
uses: release-plz/[email protected]
48+
with:
49+
command: release-pr
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
52+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

.github/workflows/release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: appimageupdate release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
attestations: write
14+
contents: write
15+
id-token: write
16+
17+
jobs:
18+
publish-binaries:
19+
name: Publish binaries
20+
runs-on: ${{ matrix.build.RUNNER }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
build:
25+
- {
26+
NAME: x86_64-linux,
27+
RUNNER: ubuntu-latest,
28+
TARGET: x86_64-unknown-linux-musl,
29+
}
30+
- {
31+
NAME: aarch64-linux,
32+
RUNNER: ubuntu-24.04-arm,
33+
TARGET: aarch64-unknown-linux-musl,
34+
}
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Set the release version
40+
shell: bash
41+
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
42+
43+
- name: Install dependencies
44+
shell: bash
45+
run: |
46+
sudo apt-get update
47+
sudo apt-get install -y --no-install-recommends musl-tools b3sum
48+
49+
- name: Install Rust toolchain
50+
uses: dtolnay/rust-toolchain@nightly
51+
with:
52+
targets: ${{ matrix.build.TARGET }}
53+
components: rust-src
54+
55+
- name: Build
56+
run: cargo build --release --locked --target ${{ matrix.build.TARGET }} -Z build-std=std,panic_abort
57+
58+
- name: Prepare release assets
59+
shell: bash
60+
run: |
61+
mkdir -p release
62+
cp {LICENSE,README.md} release/
63+
cp "target/${{ matrix.build.TARGET }}/release/appimageupdate" release/
64+
65+
- name: Create release artifacts
66+
shell: bash
67+
run: |
68+
cp release/appimageupdate appimageupdate-${{ matrix.build.NAME }}
69+
b3sum appimageupdate-${{ matrix.build.NAME }} > appimageupdate-${{ matrix.build.NAME }}.b3sum
70+
tar -cJvf appimageupdate-${{ matrix.build.NAME }}.tar.xz release/
71+
b3sum appimageupdate-${{ matrix.build.NAME }}.tar.xz > appimageupdate-${{ matrix.build.NAME }}.tar.xz.b3sum
72+
73+
- name: Upload to release
74+
uses: svenstaro/upload-release-action@v2
75+
with:
76+
repo_token: ${{ secrets.GITHUB_TOKEN }}
77+
file: appimageupdate-${{ matrix.build.NAME }}*
78+
file_glob: true
79+
overwrite: true
80+
tag: ${{ github.ref }}
81+
82+
- name: Attest Build Provenance
83+
uses: actions/attest-build-provenance@v2
84+
with:
85+
subject-name: "appimageupdate-${{ matrix.build.NAME }}"
86+
subject-path: appimageupdate-${{ matrix.build.NAME }}*

.release-plz.toml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
[workspace]
2+
allow_dirty = false
3+
changelog_update = true
4+
dependencies_update = false
5+
git_release_enable = false
6+
pr_labels = ["release"]
7+
publish_allow_dirty = false
8+
semver_check = true
9+
release_always = false
10+
git_release_body = """
11+
{{ changelog }}
12+
{% if remote.contributors %}
13+
### Contributors
14+
{% for contributor in remote.contributors %}
15+
* @{{ contributor.username }}
16+
{% endfor %}
17+
{% endif %}
18+
"""
19+
20+
[[package]]
21+
name = "appimageupdate"
22+
git_tag_name = "{{ version }}"
23+
git_release_enable = true
24+
changelog_path="./CHANGELOG.md"
25+
26+
[changelog]
27+
header = """
28+
"""
29+
body = """
30+
{% macro print_commit(commit) -%}
31+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
32+
{% if commit.breaking %}[**breaking**] {% endif %}\
33+
{{ commit.message | upper_first }} - \
34+
([{{ commit.id | truncate(length=7, end="") }}]({{ remote.link }}/commit/{{ commit.id }}))\
35+
{% endmacro -%}
36+
37+
{% if version %}\
38+
{% if previous.version %}\
39+
## [{{ version | trim_start_matches(pat="v") }}]\
40+
({{ release_link }}) - {{ timestamp | date(format="%Y-%m-%d") }}
41+
{% else %}\
42+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
43+
{% endif %}\
44+
{% else %}\
45+
## [unreleased]
46+
{% endif %}\
47+
48+
{% for group, commits in commits | group_by(attribute="group") %}
49+
### {{ group | striptags | trim | upper_first }}
50+
{% for commit in commits
51+
| filter(attribute="scope")
52+
| sort(attribute="scope") %}
53+
{{ self::print_commit(commit=commit) }}
54+
{%- endfor %}
55+
{% for commit in commits %}
56+
{%- if not commit.scope -%}
57+
{{ self::print_commit(commit=commit) }}
58+
{% endif -%}
59+
{% endfor -%}
60+
{% endfor -%}
61+
"""
62+
trim = true
63+
commit_parsers = [
64+
{ message = "^feat", group = "<!-- 0 -->⛰️ Features" },
65+
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
66+
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
67+
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
68+
{ message = "^refactor\\(clippy\\)", skip = true },
69+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
70+
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
71+
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
72+
{ message = "^chore\\(release\\)", skip = true },
73+
{ message = "^chore\\(deps.*\\)", skip = true },
74+
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
75+
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
76+
]

0 commit comments

Comments
 (0)