feat: semantic release workflow #10
@@ -2,8 +2,8 @@ name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
@@ -13,9 +13,44 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Semantic release
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
# "true" only when semantic-release actually published a release.
|
||||
released: ${{ steps.semantic_release.outputs.released }}
|
||||
steps:
|
||||
# Check out with the bot token so semantic-release can push the version
|
||||
# bump and tag past branch protection (the default token cannot).
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.MX_GITEA_BOT_TOKEN }}
|
||||
- uses: https://github.com/dtolnay/rust-toolchain@stable
|
||||
- uses: https://github.com/Swatinem/rust-cache@v2
|
||||
- name: Install cargo-edit
|
||||
uses: https://github.com/taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-edit
|
||||
- name: Semantic release
|
||||
id: semantic_release
|
||||
env:
|
||||
# Used by the curl step in .releaserc.json to create the Gitea release.
|
||||
GITEA_URL: https://gitea.psi.ch
|
||||
GITEA_REPO: ${{ github.repository }}
|
||||
MX_GITEA_BOT_TOKEN: ${{ secrets.MX_GITEA_BOT_TOKEN }}
|
||||
run: |
|
||||
npx --yes \
|
||||
-p semantic-release@25 \
|
||||
-p @semantic-release/exec \
|
||||
-p @semantic-release/git \
|
||||
semantic-release
|
||||
|
||||
build-rpm:
|
||||
name: Build and push RPM
|
||||
runs-on: ubuntu-latest
|
||||
needs: release
|
||||
if: needs.release.outputs.released == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: https://github.com/dtolnay/rust-toolchain@stable
|
||||
@@ -23,6 +58,8 @@ jobs:
|
||||
|
||||
- name: Build RPM
|
||||
run: |
|
||||
# Pick up the version bump semantic-release just committed.
|
||||
git pull
|
||||
cargo build --release
|
||||
strip -s target/release/aarel
|
||||
cargo install cargo-generate-rpm
|
||||
|
||||
@@ -24,3 +24,24 @@ selects a different config file; it defaults to `data/defaults.json`.
|
||||
|
||||
`gui` and `server` pick their config entry from the detected beamline. Use
|
||||
`--entry <name>` to launch a different one.
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
cargo build # build
|
||||
cargo test # run the tests
|
||||
cargo fmt --all # format
|
||||
cargo clippy --all-targets --all-features -- -D warnings # lint
|
||||
```
|
||||
|
||||
Releases are automated with [semantic-release]: merging a PR to `main` derives
|
||||
the next version from the commit history, bumps `Cargo.toml`, tags the release
|
||||
and builds the RPM.
|
||||
|
||||
> **Commit messages must follow [Conventional Commits].** The release version and
|
||||
> notes are generated from them, so a commit that isn't `feat:`, `fix:`, etc.
|
||||
> produces no release. Use `feat:` for a minor bump, `fix:` for a patch, and a
|
||||
> `feat!:`/`fix!:` (or a `BREAKING CHANGE:` footer) for a major bump.
|
||||
|
||||
[semantic-release]: https://semantic-release.gitbook.io/
|
||||
[Conventional Commits]: https://www.conventionalcommits.org/
|
||||
|
||||
Reference in New Issue
Block a user