Skip to content

Release

Release #16

Workflow file for this run

name: Release
on:
push:
tags: [v*]
env:
NAME: ${{ github.event.repository.name }}
defaults:
run:
shell: bash
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
read-version:
name: Read version
runs-on: ubuntu-latest
outputs:
source_name: ${{ env.NAME }}-${{ steps.version.outputs.VERSION }}
steps:
- name: Read version
id: version
env:
REF: ${{ github.ref }}
run: echo "VERSION=${REF/refs\/tags\//}" >> $GITHUB_OUTPUT
source-checksum-upload:
name: Source checksum upload
needs: [create-release, read-version]
runs-on: ubuntu-latest
steps:
- name: Calculate checksum
run: |
curl -sL ${{ github.event.repository.html_url }}/archive/${{ github.ref }}.zip > upload.zip
echo $(sha256sum upload.zip | cut -d ' ' -f 1) > sha256sum.txt
- name: Upload checksums
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./sha256sum.txt
asset_name: ${{ needs.read-version.outputs.source_name }}_sha256sum.txt
asset_content_type: text/plain
build-upload:
name: Build & Upload
needs: [create-release, read-version]
strategy:
fail-fast: false
matrix:
include:
- os: macos-13
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: i686-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-msvc
# - i686-pc-windows-gnu
# - x86_64-pc-windows-gnu
runs-on: ${{ matrix.os }}
steps:
- name: Install rust
uses: dtolnay/[email protected]
with:
target: ${{ matrix.target }}
- name: Install linker
if: matrix.target == 'i686-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install gcc-multilib
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: cargo build --target ${{ matrix.target }} --release
- name: Set variables
id: vars
env:
BUILD_NAME: ${{ needs.read-version.outputs.source_name }}-${{ matrix.target }}
run: echo "BUILD_NAME=$BUILD_NAME" >> $GITHUB_OUTPUT
- name: Ready artifacts
run: |
mkdir upload
cp target/${{ matrix.target }}/release/$NAME LICENSE upload
- name: Compress artifacts
uses: vimtor/action-zip@v1
with:
files: upload/
recursive: true
dest: upload.zip
- name: Upload artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./upload.zip
asset_name: ${{ steps.vars.outputs.BUILD_NAME }}.zip
asset_content_type: application/zip
- name: Calculate checksum
if: runner.os == 'macOS'
run: echo $(shasum -a 256 upload.zip | cut -d ' ' -f 1) > sha256sum.txt
- name: Calculate checksum
if: runner.os != 'macOS'
run: echo $(sha256sum upload.zip | cut -d ' ' -f 1) > sha256sum.txt
- name: Upload checksums
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./sha256sum.txt
asset_name: ${{ steps.vars.outputs.BUILD_NAME }}_sha256sum.txt
asset_content_type: text/plain