Skip to content

Update Cargo package #3

Update Cargo package

Update Cargo package #3

Workflow file for this run

name: Release πŸ“¦
permissions:
contents: write
pull-requests: write
on:
push:
tags:
- 'v*.*.*'
env:
CARGO_TERM_COLOR: always
jobs:
release:
name: Release - ${{ matrix.platform.release_for }}
strategy:
matrix:
platform:
- release_for: linux-arm64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- release_for: linux-amd64
os: ubuntu-latest
target: x86_64-unknown-linux-musl
- release_for: darwin-amd64
os: macOS-latest
target: x86_64-apple-darwin
- release_for: darwin-arm64
os: macOS-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set tag
id: set_tag
run: |
# Extract the tag name from the full reference
TAG_NAME=$(echo "${{ github.ref }}" | sed 's|.*/||')
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV"
- name: Setup dependencies
if: matrix.platform.os == 'ubuntu-latest'
run: |
sudo apt-get -qq install musl-dev musl-tools pkg-config make
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
target: ${{ matrix.platform.target }}
args: "--locked --release"
strip: true
- name: Package zip
# if: startsWith(github.ref, 'refs/tags/')
run: |
make package PLATFORM=${{ matrix.platform.release_for }} TARGET=${{ matrix.platform.target }}
- name: Release
uses: softprops/action-gh-release@v2
# if: startsWith(github.ref, 'refs/tags/')
with:
body: '[Changelog](https://github.com/containerscrew/gitrack/blob/main/CHANGELOG.md)'
files: |
CHANGELOG.md
LICENSE
*.zip
env:
token: ${{ secrets.RELEASE_TOKEN }}
generate_release_notes: true
append_body: true
changelog:
name: Generate CHANGELOG
needs:
- release
runs-on: ubuntu-latest
steps:
- name: Install git cliff
run: |
rustup default stable
cargo install git-cliff
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set tag
id: set_tag
run: |
# Extract the tag name from the full reference
TAG_NAME=$(echo "${{ github.ref }}" | sed 's|.*/||')
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV"
- name: Update CHANGELOG.md in main branch
# if: github.ref == 'refs/tags/v*.*.*'
run: |
git checkout main
git pull origin main
git config --global user.name 'containerscrew'
git config --global user.email '[email protected]'
make generate-changelog
git add CHANGELOG.md
git commit -m "Update CHANGELOG.md for release ${{ env.TAG_NAME }}"
git push origin main