Skip to content

Commit

Permalink
Setup GitHub action to release binary packages
Browse files Browse the repository at this point in the history
  • Loading branch information
iquiw committed Oct 6, 2024
1 parent 1995b7b commit 8fe3972
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release

on:
push:
tags:
- "*"

defaults:
run:
shell: bash

jobs:
release:
strategy:
matrix:
target:
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
- x86_64-unknown-linux-musl
include:
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release --locked

- name: Package
run: |
exe=rireq
if [ "${OS}" = windows-latest ]; then
exe=rireq.exe
fi
mkdir dist release
mv "target/${TARGET}/release/${exe}" dist/
cd dist
tar caf "release/rireq-${VERSION}-${TARGET}.tar.gz" "${exe}"
sha256sum "release/rireq-${VERSION}-${TARGET}.tar.gz" "release/rireq-${VERSION}-${TARGET}.tar.gz.sha256"
env:
TARGET: ${{ matrix.target }}
VERSION: ${{ github.ref_name }}
shell: bash

- name: Publish
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: 'release/*'
body: |
* rireq ${{ github.ref_name }}

0 comments on commit 8fe3972

Please sign in to comment.