refactor, chore(deps): support rust 2024 edition, update deps #126
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
# adapted copy from https://github.com/termapps/enquirer/blob/master/.github/workflows/release.yml | |
env: | |
NAME: rickview | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
RUSTFLAGS: -Dwarnings | |
name: Release | |
on: | |
push: | |
tags: '[0-9]+\.[0-9]+\.[0-9]+*' | |
jobs: | |
create-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
steps: | |
- name: Build Changelog | |
id: build-changelog | |
uses: mikepenz/release-changelog-builder-action@v5 | |
with: | |
mode: "COMMIT" | |
configurationJson: | | |
{ | |
"pr_template": "- #{{TITLE}}", | |
"template": "#{{UNCATEGORIZED}}" | |
} | |
- name: Create Release | |
id: create-release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body: ${{steps.build-changelog.outputs.changelog}} | |
read-version: | |
name: Read version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.VERSION }} | |
steps: | |
- name: Read version | |
id: version | |
env: | |
REF: ${{ github.ref }} | |
shell: bash | |
run: echo "VERSION=${REF/refs\/tags\//}" >> $GITHUB_OUTPUT | |
build-upload: | |
name: Build & Upload | |
needs: [create-release, read-version] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-22.04-arm | |
target: aarch64-unknown-linux-gnu | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
# - os: windows-latest | |
# target: i686-pc-windows-msvc | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Set up cargo cache | |
uses: actions/cache@v4 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo | |
#- name: Install linker # we don't build for 32 bit so we don't need this | |
# if: matrix.target == 'i686-unknown-linux-gnu' | |
# run: sudo apt-get install gcc-multilib | |
#- name: Install aarch64 gcc # should not be needed anymore with the ARM runner | |
# if: matrix.target == 'aarch64-unknown-linux-gnu' | |
# run: sudo apt-get install gcc-aarch64-linux-gnu | |
- name: Install musl | |
if: contains(matrix.target, 'linux-musl') | |
run: sudo apt-get install musl-tools | |
- name: Build | |
run: cargo build --target ${{ matrix.target }} --release | |
- name: Set variables | |
id: vars | |
env: | |
BUILD_NAME: ${{ env.NAME }}-${{ needs.read-version.outputs.version }}-${{ matrix.target }} | |
shell: bash | |
run: | | |
echo "BUILD_NAME=${BUILD_NAME}" >> $GITHUB_OUTPUT | |
echo "BUILD_NAME=${BUILD_NAME}" >> $GITHUB_ENV | |
- name: Ready artifacts | |
env: | |
BUILD_NAME: ${{ steps.vars.outputs.BUILD_NAME }} | |
TARGET: ${{ matrix.target }} | |
shell: bash | |
run: | | |
mkdir "${BUILD_NAME}" | |
# cp target/$TARGET/release/$NAME LICENSE *.md $NAME.1 $BUILD_NAME | |
cp target/$TARGET/release/$NAME $BUILD_NAME | |
- name: Compress artifacts | |
uses: papeloto/action-zip@v1 | |
with: | |
files: ${{ steps.vars.outputs.BUILD_NAME }}/ | |
recursive: false | |
dest: ${{ steps.vars.outputs.BUILD_NAME }}.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: ./${{ steps.vars.outputs.BUILD_NAME }}.zip | |
asset_name: ${{ steps.vars.outputs.BUILD_NAME }}.zip | |
asset_content_type: application/zip |