Files
jj-cz/.github/workflows/release.yml
Lucien Cartier-Tilet 67f5537178
Some checks failed
Release / checks (push) Successful in 9m22s
Release / release (push) Failing after 32s
Publish Docker Images / coverage-and-sonar (push) Successful in 18m44s
chore(release): prepare 1.0.0 release
2026-03-24 17:35:03 +01:00

99 lines
3.1 KiB
YAML

name: Release
on:
push:
branches:
- main
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run Checks
run: nix develop --no-pure-eval --accept-flake-config --command just check-all
release:
needs: checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.CI_TOKEN }}
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Check for releasable commits
id: releasable
run: |
COUNT=$(git-cliff --unreleased | tail -n +3 | wc -l)
echo "count=$COUNT" >> $GITHUB_OUTPUT
- name: Determine next version
if: steps.releasable.outputs.count > 0
id: next_version
run: echo "version=$(git-cliff --bumped-version)" >> $GITHUB_OUTPUT
- name: Update changelog
if: steps.releasable.outputs.count > 0
run: git-cliff --bump -o CHANGELOG.md
- name: Create release commit
if: steps.releasable.outputs.count > 0
run: |
VERSION=${{ steps.next_version.outputs.version }}
nix develop --no-pure-eval --accept-flake-config --command cargo set-version "$VERSION"
git config user.name "CI Bot"
git config user.email "ci@phundrak.com"
git add Cargo.toml Cargo.lock CHANGELOG.md
git commit -m "chore(release): release $VERSION [skip ci]"
git push origin main
- name: Create version tag
if: steps.releasable.outputs.count > 0
run: |
VERSION=${{ steps.next_version.outputs.version }}
git tag "$VERSION"
git push origin "$VERSION"
- name: Build Linux release binaries
if: steps.releasable.outputs.count > 0
run: nix build
- name: Build Windows release binaries
if: steps.releasable.outputs.count > 0
run: nix build .#windows
- name: Publish on crates.io
if: steps.releasable.outputs.count > 0
run: nix develop --no-pure-eval --accept-flake-config --command cargo publish
env:
CARGO_REGISTRIES_CRATES_IO_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Rebase develop onto main
if: steps.releasable.outputs.count > 0
run: |
git fetch origin
git checkout develop
git rebase origin/main
- name: Bump to next dev version
if: steps.releasable.outputs.count > 0
run: |
VERSION=${{ steps.next_version.outputs.version }}
# Bump patch and append -dev
NEXT_DEV=$(echo $VERSION | awk -F. '{print $1"."$2"."$3+1}')"-dev"
nix develop --no-pure-eval --accept-flake-config --command cargo set-version "$NEXT_DEV"
git add Cargo.toml Cargo.lock
git commit -m "chore(release): bump version to $NEXT_DEV [skip ci]"
git push origin develop