name: _release
on:
workflow_call:
inputs:
release_tag:
description: 'The release tag (e.g. v1.0.0)'
required: true
type: string
secrets:
CARGO_REGISTRY_TOKEN:
description: 'Token for publishing to crates.io'
required: true
env:
CARGO_TERM_COLOR: always
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Generate Release Notes
id: changelog
uses: orhun/git-cliff-action@v4
with:
config: .github/cliff.toml
args: --latest --strip header
- name: Update Version for crates.io
run: |
VERSION="${{ inputs.release_tag }}"
# Strip the 'v' prefix if present
VERSION="${VERSION#v}"
sed -i "s/0\\.0\\.0-git/$VERSION/" Cargo.toml
sed -i "s/0\\.0\\.0-git/$VERSION/" Cargo.lock
- name: Publish to crates.io
run: cargo publish --no-verify --allow-dirty --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Download Linux Build
uses: actions/download-artifact@v8
with:
name: gitopolis-linux-x86_64
path: artifacts
- name: Download Windows Build
uses: actions/download-artifact@v8
with:
name: gitopolis-windows-x86_64
path: artifacts
- name: Download macOS x86_64 Build
uses: actions/download-artifact@v8
with:
name: gitopolis-macos-x86_64
path: artifacts
- name: Download macOS aarch64 Build
uses: actions/download-artifact@v8
with:
name: gitopolis-macos-aarch64
path: artifacts
- name: Generate SHA256 Checksums
working-directory: artifacts
run: |
sha256sum gitopolis-linux-x86_64.tar.gz gitopolis-windows-x86_64.zip gitopolis-macos-x86_64.tar.gz gitopolis-macos-aarch64.tar.gz > SHA256SUMS.txt
- name: Create Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ inputs.release_tag }}
name: ${{ inputs.release_tag }}
body: ${{ steps.changelog.outputs.content }}
files: |
artifacts/gitopolis-linux-x86_64.tar.gz
artifacts/gitopolis-windows-x86_64.zip
artifacts/gitopolis-macos-x86_64.tar.gz
artifacts/gitopolis-macos-aarch64.tar.gz
artifacts/SHA256SUMS.txt