feat: add release script #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- run: npx changelogithub | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
release: | |
name: ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
output: catj | |
archive: tar.gz | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
output: catj | |
archive: tar.gz | |
# - target: arm-unknown-linux-gnueabihf | |
# os: ubuntu-latest | |
# output: catj | |
# archive: tar.gz | |
# - target: arm-unknown-linux-musleabihf | |
# os: ubuntu-latest | |
# output: catj | |
# archive: tar.gz | |
# - target: aarch64-unknown-linux-gnu | |
# os: ubuntu-latest | |
# output: catj | |
# archive: tar.gz | |
# - target: aarch64-unknown-linux-musl | |
# os: ubuntu-latest | |
# output: catj | |
# archive: tar.gz | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
target: ${{ matrix.target }} | |
override: true | |
- name: Run Test | |
run: | | |
sudo ./init.sh $USER | |
export RUST_BACKTRACE=full RUST_TEST_TASK=1 | |
cargo test | |
- name: Build release | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target ${{ matrix.target }} --release | |
use-cross: ${{ matrix.os == 'ubuntu-latest' }} | |
- name: Copy and rename utility | |
run: cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }} | |
- name: Create archive | |
run: | | |
tar -czvf catj-${{ matrix.target }}.${{ matrix.archive }} ${{ matrix.output }} | |
sha256sum catj-${{ matrix.target }}.${{ matrix.archive }} > catj-${{ matrix.target }}-sha256sum.txt | |
- name: Upload artifacts archive | |
uses: actions/upload-artifact@v1 | |
with: | |
name: catj-${{ matrix.target }}.${{ matrix.archive }} | |
path: catj-${{ matrix.target }}.${{ matrix.archive }} | |
- name: Upload artifacts checksum | |
uses: actions/upload-artifact@v1 | |
with: | |
name: catj-${{ matrix.target }}-sha256sum.txt | |
path: catj-${{ matrix.target }}-sha256sum.txt | |
- name: Upload binary to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GH_TOKEN }} | |
tag: ${{ github.ref }} | |
file: catj-${{ matrix.target }}.${{ matrix.archive }} | |
asset_name: catj-${{ matrix.target }}.${{ matrix.archive }} | |
overwrite: true | |
- name: Upload checksum to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GH_TOKEN }} | |
tag: ${{ github.ref }} | |
file: catj-${{ matrix.target }}-sha256sum.txt | |
asset_name: catj-${{ matrix.target }}-sha256sum.txt | |
overwrite: true |