name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-14
target: aarch64-apple-darwin
- os: macos-15-intel
target: x86_64-apple-darwin
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
run: |
cd target/${{ matrix.target }}/release
tar czf lazygocd-${{ github.ref_name }}-${{ matrix.target }}.tar.gz lazygocd
shasum -a 256 lazygocd-${{ github.ref_name }}-${{ matrix.target }}.tar.gz > lazygocd-${{ github.ref_name }}-${{ matrix.target }}.tar.gz.sha256
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: |
target/${{ matrix.target }}/release/lazygocd-*.tar.gz
target/${{ matrix.target }}/release/lazygocd-*.sha256
build-windows:
name: Build x86_64-pc-windows-msvc
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Build
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Package
shell: pwsh
env:
REF_NAME: ${{ github.ref_name }}
run: |
$name = "lazygocd-$env:REF_NAME-x86_64-pc-windows-msvc"
Compress-Archive -Path target/x86_64-pc-windows-msvc/release/lazygocd.exe -DestinationPath "$name.zip"
$hash = (Get-FileHash "$name.zip" -Algorithm SHA256).Hash.ToLower()
"$hash $name.zip" | Out-File -Encoding ascii "$name.zip.sha256"
- uses: actions/upload-artifact@v4
with:
name: x86_64-pc-windows-msvc
path: |
lazygocd-*.zip
lazygocd-*.sha256
release:
needs: [build, build-windows]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
files: |
lazygocd-*.tar.gz
lazygocd-*.zip
lazygocd-*.sha256
generate_release_notes: true