0.1.21 #30
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: Build and Release on Linux | |
permissions: | |
contents: write | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build_and_release: | |
name: release ${{ matrix.target }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
archive: tar.gz | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-unknown-linux-gnu | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-directories: ".bin" | |
- name: Build project | |
run: | | |
cargo build --release --target ${{ matrix.target }} | |
- name: Build archive | |
shell: bash | |
run: | | |
binary_name="archer" | |
dirname="$binary_name-${{ github.ref_name }}-${{ matrix.target }}" | |
mkdir "$dirname" | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" | |
else | |
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" | |
fi | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
7z a "$dirname.zip" "$dirname" | |
echo "ASSET=$dirname.zip" >> $GITHUB_ENV | |
else | |
tar -czf "$dirname.tar.gz" "$dirname" | |
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | |
fi | |
- name: Release | |
id: release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: "v${{ github.ref_name }}" | |
files: ${{ env.ASSET }} | |
publish_to_aur: | |
name: "publish to aur" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
needs: | |
- build_and_release | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-unknown-linux-gnu | |
- name: Install cargo-aur | |
run: cargo install cargo-aur | |
- name: Generate PKGBUILD | |
run: cargo aur | |
- name: Update pkgver in PKGBUILD | |
run: sed -i 's/v$pkgver/$pkgver/g' ./target/cargo-aur/PKGBUILD | |
- name: Upload aur binary to existing release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "target/cargo-aur/archer-${{ github.ref_name }}-x86_64.tar.gz" | |
tag: "${{ github.ref_name }}" | |
overwrite: true | |
- name: Release AUR package | |
uses: jbouter/aur-releaser@v0.0.9 | |
with: | |
pkgname: archer-bin | |
pkgbuild: ./target/cargo-aur/PKGBUILD | |
commit_username: ${{ secrets.AUR_USERNAME }} | |
commit_email: ${{ secrets.AUR_EMAIL }} | |
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
commit_message: Update AUR package | |
ssh_keyscan_types: rsa,dsa,ecdsa,ed25519 |