Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
build:
name: Build ${{ matrix.archive }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
archive: steplock-Linux-x86_64
- os: macos-latest
target: aarch64-apple-darwin
archive: steplock-Darwin-arm64
- os: macos-13
target: x86_64-apple-darwin
archive: steplock-Darwin-x86_64
steps:
- uses: actions/checkout@v4

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
core/target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('core/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-release-

- name: Build
run: cargo build --manifest-path core/Cargo.toml --release --target ${{ matrix.target }}

- name: Package
run: |
cd core/target/${{ matrix.target }}/release
tar -czf "${{ matrix.archive }}.tar.gz" steplock
mv "${{ matrix.archive }}.tar.gz" ../../../../

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.archive }}
path: ${{ matrix.archive }}.tar.gz

release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Create release
run: |
gh release create "${{ github.ref_name }}" \
--title "${{ github.ref_name }}" \
--generate-notes \
artifacts/*.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish:
name: Publish to crates.io
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: Publish crate
run: cargo publish --manifest-path core/Cargo.toml
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Loading