v2.0.5 #56
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
# This workflow creates all the needed binaries, uploads the binaries to github releases and updates the crate as well as the | |
# homebrew tap. | |
# The binaries include versions from linux x86_64 and arm, windows gnu and mscv and macos x86_64 and arm versions. | |
# It also creates a .deb package using the cargo-deb crate. | |
name: Build Release files | |
on: | |
#switch for debugging | |
# [push] | |
release: | |
types: [published] | |
jobs: | |
release_assets_linux: | |
name: Release Linux Assets | |
#create and release different linux builds for arm and x86 | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
rust: | |
- stable | |
target: | |
#compile for x86 and armv8 (64-Bit) | |
- x86_64-unknown-linux-gnu | |
# - aarch64-unknown-linux-gnu | |
#compile with musl | |
- x86_64-unknown-linux-musl | |
# - aarch64-unknown-linux-musl | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install ${{ matrix.rust }} toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
targets: ${{ matrix.target }} | |
- name: Install musl-gcc | |
if: contains(${{ matrix.target }}, "musl") #arm build can not run tests | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user musl-tools musl-dev | |
# https://github.com/briansmith/ring/blob/main/mk/install-build-tools.sh | |
- name: Install aarch64-linux-gnu-gcc | |
if: contains(${{ matrix.target }}, "aarch64") #arm build can not run tests | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user gcc-aarch64-linux-gnu libc6-dev-arm64-cross | |
- name: Build artem release | |
continue-on-error: false | |
run: cargo build --locked --release --verbose --target=${{ matrix.target }} | |
#from: https://github.com/sharkdp/bat/blob/master/.github/workflows/CICD.yml | |
- name: Extract Version Number | |
shell: bash | |
run: echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
- name: Copy completion files and man page | |
shell: bash | |
run: | | |
#create a completions and doc folder | |
mkdir -p deployment/completions | |
mkdir -p deployment/doc | |
#copy completion files and man page | |
cp -u target/*/release/build/artem-*/out/* deployment/completions/ | |
# replace the input file completions, since it won't work after inputting the paths otherwise | |
sed -i "s/*::/*:/" deployment/completions/_artem | |
#move man page and CHANGELOG/README to doc folder | |
mv deployment/completions/artem.1 deployment/doc/ | |
mv CHANGELOG.md deployment/doc/ | |
mv README.md deployment/ | |
#copy binary file | |
cp -u target/*/release/artem deployment | |
- name: Compress release files | |
shell: bash | |
run: | | |
#compress deployment directory | |
cd deployment/ | |
tar -czvf ../artem-v$PROJECT_VERSION-${{ matrix.target }}.tar.gz * | |
- name: Upload Release Build | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: artem-v${{ env.PROJECT_VERSION }}-${{ matrix.target }}.tar.gz | |
draft: true | |
prerelease: true | |
release_assets_windows: | |
#this is only to release the windows build, since it has a .exe extensions will be uploaded as a zip file | |
name: Release Windows Assets | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: [windows-latest] | |
rust: | |
- stable | |
target: | |
#windows gnu | |
# - x86_64-pc-windows-gnu | |
# mscv | |
- x86_64-pc-windows-msvc | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install ${{ matrix.rust }} toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
targets: ${{ matrix.target }} | |
- name: Build artem release | |
continue-on-error: false | |
run: cargo build --locked --release --verbose --target=${{ matrix.target }} | |
- name: Extract Version Number | |
shell: bash | |
run: echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $ | |
- name: Copy completion files and man page | |
shell: bash | |
run: | | |
# create a completions and doc folder | |
mkdir -p deployment/completions | |
mkdir -p deployment/doc | |
# copy completion files and man page | |
cp -u target/*/release/build/artem-*/out/* deployment/completions/ | |
# replace the input file completions, since it won't work after inputting the paths otherwise | |
sed -i "s/*::/*:/" deployment/completions/_artem | |
#move man page and CHANGELOG/README to doc folder | |
mv deployment/completions/artem.1 deployment/doc/ | |
mv CHANGELOG.md deployment/doc/ | |
mv README.md deployment/ | |
#copy binary file | |
cp -u target/${{ matrix.target }}/release/artem.exe deployment | |
#create zip file from .exe release build | |
- name: Create zip file | |
shell: bash | |
run: | | |
7z a artem-v${{ env.PROJECT_VERSION }}-${{ matrix.target }}.zip ./deployment/* | |
#upload zip file | |
- name: Upload Release Build for Windows | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: artem-v${{ env.PROJECT_VERSION }}-${{ matrix.target }}.zip | |
draft: true | |
prerelease: true | |
release_assets_macos: | |
name: Release MacOS Assets | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: [macos-latest] | |
rust: | |
- stable | |
target: | |
#compile for x86 mac os | |
- x86_64-apple-darwin | |
#compile arm version for M1 macs (BigSur+) | |
- aarch64-apple-darwin | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install ${{ matrix.rust }} toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
target: ${{ matrix.target }} | |
- name: Build artem release | |
continue-on-error: false | |
run: cargo build --locked --release --verbose --target=${{ matrix.target }} | |
- name: Extract Version Number | |
shell: bash | |
run: echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
- name: Copy completion files and man page | |
shell: bash | |
run: | | |
#create a completions and doc folder | |
mkdir -p deployment/completions | |
mkdir -p deployment/doc | |
#copy completion files and man page | |
cp target/*/release/build/artem-*/out/* deployment/completions/ | |
# replace the input file completions, since it won't work after inputting the paths otherwise | |
sed -i "" "s/*::/*:/" deployment/completions/_artem | |
#move man page and CHANGELOG/README to doc folder | |
mv deployment/completions/artem.1 deployment/doc/ | |
mv CHANGELOG.md deployment/doc/ | |
mv README.md deployment/ | |
#copy binary file | |
cp target/*/release/artem deployment | |
- name: Compress release files | |
shell: bash | |
run: | | |
#compress deployment directory | |
cd deployment/ | |
tar -czvf ../artem-v$PROJECT_VERSION-${{ matrix.target }}.tar.gz * | |
- name: Upload Release Build | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: artem-v${{ env.PROJECT_VERSION }}-${{ matrix.target }}.tar.gz | |
draft: true | |
prerelease: true | |
release_deb: | |
name: Create Debian | |
#create a .deb package using cargo-deb | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
rust: | |
- stable | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install ${{ matrix.rust }} toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
#build release, so it contains the completion files | |
- name: Build artem release | |
continue-on-error: false | |
run: cargo build --offline --release --verbose | |
#copy to completion files from the out directory to the deployment/assets dir | |
- name: Copy completion files and man page | |
shell: bash | |
run: | | |
mkdir -p deployment/assets | |
cp -u target/release/build/artem-*/out/* deployment/assets/ | |
- name: Install cargo deb | |
continue-on-error: false | |
run: cargo install cargo-deb | |
- name: Run cargo deb | |
continue-on-error: false | |
run: cargo deb | |
- name: Upload Debian Package | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./target/debian/*.deb | |
draft: true | |
prerelease: true | |
cargo_publish: | |
name: Publish to Cargo | |
# update the cargo version, using cargo publish. | |
# this can fail, so it should be locally checked with cargo publish --dry-run before | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Publish to creates.io | |
continue-on-error: false | |
run: cargo publish --token ${{ secrets.CARGO_API_KEY }} | |
# update_homebrew_formula: | |
# name: Update Homebrew Formula | |
# # Update the released version in the homebrew tap (https://github.com/finefindus/homebrew-tap) | |
# # using action from: https://github.com/dawidd6/action-homebrew-bump-formula | |
# runs-on: ubuntu-latest # this could alternatively be run on macos | |
# steps: | |
# - uses: dawidd6/action-homebrew-bump-formula@v3 | |
# with: | |
# # this token will expire after 90 days and should be manually renewed | |
# # use this link to create a new one: https://github.com/settings/tokens/new?scopes=public_repo,workflow | |
# token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
# tap: finefindus/homebrew-tap | |
# formula: artem | |
# force: true | |
publish_aur_package: | |
name: Publish AUR package | |
# publish a compiled from source and binary release to the aur | |
needs: | |
- release_assets_linux | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract Version Number | |
shell: bash | |
run: echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
- name: Generate PKGBUILD files | |
shell: bash | |
run: | | |
#update PKGBUILD with new values | |
cd assets/aur | |
#update PKGBUILDs | |
./update_PKGBUILD.sh | |
#copy files to the deployment dir | |
cd ../../ | |
mkdir pkgbuilds/ | |
cp -u assets/aur/PKGBUILD-* pkgbuilds | |
- name: Publish artem to the AUR | |
uses: KSXGitHub/github-actions-deploy-aur@v2.2.5 | |
with: | |
pkgname: artem | |
pkgbuild: ./pkgbuilds/PKGBUILD-stable | |
commit_username: ${{ secrets.AUR_USERNAME }} | |
commit_email: ${{ secrets.AUR_EMAIL }} | |
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
commit_message: Updating to v${{ env.PROJECT_VERSION }} | |
force_push: "true" | |
- name: Publish artem-bin to the AUR | |
uses: KSXGitHub/github-actions-deploy-aur@v2.2.5 | |
with: | |
pkgname: artem-bin | |
pkgbuild: ./pkgbuilds/PKGBUILD-bin | |
commit_username: ${{ secrets.AUR_USERNAME }} | |
commit_email: ${{ secrets.AUR_EMAIL }} | |
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
commit_message: Updating to v${{ env.PROJECT_VERSION }} | |
force_push: "true" |