Skip to content

Commit

Permalink
ci: Set up release automation & tweak builds
Browse files Browse the repository at this point in the history
  • Loading branch information
VorpalBlade committed Feb 26, 2024
1 parent 324054c commit b5fa14e
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
CARGO_TERM_COLOR: always
PAKETKOLL_BUILDER: github-ci
RUST_BACKTRACE: 1
CC: clang
RUSTFLAGS: "-D warnings"
RUSTUP_MAX_RETRIES: 10

Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release

permissions:
contents: write

on:
release:
types: [published]

env:
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_NET_RETRY: 10
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: true
CARGO_PROFILE_RELEASE_OPT_LEVEL: "s"
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
CC: clang
RUSTFLAGS: -D warnings -Clink-arg=-Wl,--compress-debug-sections=zlib
RUSTUP_MAX_RETRIES: 10

defaults:
run:
shell: bash

jobs:
upload-assets:
name: ${{ matrix.target }}
if: github.repository_owner == 'VorpalBlade' && startsWith(github.event.release.name, 'paketkoll-v')
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- target: aarch64-unknown-linux-musl
- target: armv7-unknown-linux-musleabihf
- target: i686-unknown-linux-musl
- target: riscv64gc-unknown-linux-gnu
- target: x86_64-unknown-linux-musl
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cross
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: paketkoll
target: ${{ matrix.target }}
# Include version number.
archive: $bin-$tag-$target
token: ${{ secrets.GITHUB_TOKEN }}

# TODO: Add AUR package build and upload (copy chezmoi_modify_manager)
62 changes: 62 additions & 0 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[workspace]
git_release_enable = false

[[package]]
name = "paketkoll_core"
publish_no_verify = true

[[package]]
name = "paketkoll"
# We only want GH releases for the binary
git_release_enable = true
git_release_type = "auto"

[changelog]
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
header = """
# Changelog\n
All notable changes to this project will be documented in this file.
Keep in mind that this is only updated when releases are made and the file
is generated automatically from commit messages.\n
For a possibly more edited message (for major changes) please see the github
releases.\n
"""
protect_breaking_commits = true
sort_commits = "newest"
trim = true

commit_preprocessors = [
# remove issue numbers from commits
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
]

commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->πŸš€ Shiny new things (features)" },
{ message = "^fix", group = "<!-- 1 -->πŸ› No longer broken (bug fixes)" },
{ message = "^doc", group = "<!-- 3 -->πŸ“š Things to read (documentation)" },
{ message = "^perf", group = "<!-- 4 -->⚑ Go faster! (performance)" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Now more maintainable (refactor)" },
{ message = "^style", group = "<!-- 5 -->🎨 Now easier to read (styling)" },
{ message = "^test", group = "<!-- 6 -->πŸ§ͺ Now we know (testing)" },
{ message = "^(churn|chore)\\(release\\): prepare for", skip = true },
{ message = "^(churn|chore)\\(deps.*\\)", skip = true },
{ message = "^(churn|chore)\\(pr\\)", skip = true },
{ message = "^(churn|chore)\\(pull\\)", skip = true },
{ message = "^churn|chore|ci", group = "<!-- 7 -->βš™οΈ Other stuff" },
{ body = ".*security", group = "<!-- 8 -->πŸ›‘οΈ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
]

0 comments on commit b5fa14e

Please sign in to comment.