2020-11-23 14:11:36 +01:00
|
|
|
name: Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
|
|
|
|
jobs:
|
2022-10-11 09:43:04 +02:00
|
|
|
tests:
|
|
|
|
uses: vbrandl/hoc/.github/workflows/rust.yml@master
|
|
|
|
|
2020-11-23 14:11:36 +01:00
|
|
|
publish:
|
|
|
|
name: Publishing for ${{ matrix.os }}
|
2022-10-11 09:43:04 +02:00
|
|
|
needs: [tests]
|
2020-11-23 14:11:36 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
|
|
|
rust: [stable]
|
|
|
|
include:
|
|
|
|
- os: macos-latest
|
|
|
|
artifact_prefix: macos
|
|
|
|
target: x86_64-apple-darwin
|
|
|
|
binary_postfix: ""
|
|
|
|
- os: ubuntu-latest
|
|
|
|
artifact_prefix: linux
|
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
binary_postfix: ""
|
|
|
|
- os: windows-latest
|
|
|
|
artifact_prefix: windows
|
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
binary_postfix: ".exe"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2022-10-11 09:43:04 +02:00
|
|
|
uses: actions/checkout@v3
|
2020-11-23 14:11:36 +01:00
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: ${{ matrix.rust }}
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Cache cargo registry, index and build directory
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
./target
|
2022-10-11 09:43:04 +02:00
|
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
2020-11-23 14:11:36 +01:00
|
|
|
|
|
|
|
- name: Cargo build
|
2022-10-18 12:40:26 +02:00
|
|
|
uses: actions-rs/cargo@v1
|
2020-11-23 14:11:36 +01:00
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
toolchain: ${{ matrix.rust }}
|
|
|
|
args: --release --target ${{ matrix.target }}
|
|
|
|
|
|
|
|
- name: Packaging final binary
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cd target/${{ matrix.target }}/release
|
|
|
|
strip hoc${{ matrix.binary_postfix }}
|
|
|
|
tar czvf hoc-${{ matrix.artifact_prefix }}.tar.gz hoc${{ matrix.binary_postfix }}
|
|
|
|
|
|
|
|
if [[ ${{ runner.os }} == 'Windows' ]]; then
|
|
|
|
certutil -hashfile hoc-${{ matrix.artifact_prefix }}.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > hoc-${{ matrix.artifact_prefix }}.sha256
|
|
|
|
else
|
|
|
|
shasum -a 256 hoc-${{ matrix.artifact_prefix }}.tar.gz > hoc-${{ matrix.artifact_prefix }}.sha256
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Releasing assets
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
target/${{ matrix.target }}/release/hoc-${{ matrix.artifact_prefix }}.tar.gz
|
|
|
|
target/${{ matrix.target }}/release/hoc-${{ matrix.artifact_prefix }}.sha256
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-10-11 09:43:04 +02:00
|
|
|
|
|
|
|
changelog:
|
|
|
|
name: Update Changelog
|
|
|
|
needs: [tests]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: taiki-e/create-gh-release-action@v1
|
|
|
|
with:
|
|
|
|
changelog: CHANGELOG.md
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|