v1.0.2 #15
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*' | |
env: | |
APP_NAME: tin | |
jobs: | |
create-github-release: | |
name: Create GitHub Release | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# it is a must! | |
fetch-depth: 0 | |
- name: Set the release version | |
shell: bash | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV | |
echo ${{ env.RELEASE_VERSION }} | |
- name: Checkout current tag | |
shell: bash | |
run: | | |
git checkout v${{ env.RELEASE_VERSION }} | |
- name: Generate a changelog | |
uses: orhun/git-cliff-action@v2 | |
id: git-cliff | |
with: | |
config: configs/cliff.toml | |
args: -vv --strip header --current | |
env: | |
OUTPUT: CHANGELOG.md.tmp | |
- name: Print the changelog | |
run: cat "${{ steps.git-cliff.outputs.changelog }}" | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
name: "v${{ env.RELEASE_VERSION }}" | |
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
generate_release_notes: true | |
body_path: "${{ steps.git-cliff.outputs.changelog }}" | |
publish: | |
name: Publish | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# `sfackler/rust-openssl` needs more effort to compile to musl | |
- { build: linux-gnu, os: ubuntu-22.04, target: x86_64-unknown-linux-gnu } | |
- { build: win-gnu, os: windows-2022, target: x86_64-pc-windows-gnu } | |
- { build: win-msvc, os: windows-2022, target: x86_64-pc-windows-msvc } | |
- { build: win32-msvc, os: windows-2022, target: i686-pc-windows-msvc } | |
- { build: macos, os: macos-12, target: x86_64-apple-darwin } | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set the release version | |
shell: bash | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV | |
echo ${{ env.RELEASE_VERSION }} | |
- name: Install musl-tools | |
if: matrix.target == 'x86_64-unknown-linux-musl' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
--allow-unauthenticated musl-tools | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
- name: Build | |
run: cargo build --release --locked --target ${{ matrix.target }} | |
- name: Build archive | |
shell: bash | |
run: | | |
outdir="./target/release" | |
staging="${{ env.APP_NAME }}-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" | |
mkdir -p "$staging"/doc | |
cp -r {README.md,LICENSE*} "$staging/" | |
cp -r {CHANGELOG.md,docs/*} "$staging/doc/" | |
if [[ "${{ matrix.os }}" =~ ^windows-.*$ ]]; then | |
cp "target/${{ matrix.target }}/release/${{ env.APP_NAME }}.exe" "$staging/" | |
cd "$staging" | |
7z a "../$staging.zip" . | |
echo "ASSET=$staging.zip" >> $GITHUB_ENV | |
else | |
cp "target/${{ matrix.target }}/release/${{ env.APP_NAME }}" "$staging/" | |
tar czf "$staging.tar.gz" -C "$staging" . | |
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV | |
fi | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
name: "v${{ env.RELEASE_VERSION }}" | |
files: ${{ env.ASSET }} | |
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
generate_release_notes: false |