Skip to content

Workflow file for this run

name: Rust static build and publish
on: ["push"]
# push:
# tags:
# - '*'
env:
CARGO_TERM_COLOR: always
BUILD_TARGET: x86_64-unknown-linux-musl
BINARY_NAME: rexec
jobs:
build:
name: Build static binary
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build-musl
uses: gmiam/rust-musl-action@master
with:
args: cargo build --target $BUILD_TARGET --release
- name: Get version
run: echo "VERSION=$(grep -P '^version = \"\d+\.\d+\.\d+\"' Cargo.toml | awk -F '\"' '{print $2}')" >> $GITHUB_ENV
- name: Show version
run: echo ${{ env.VERSION }}
- uses: actions/upload-artifact@v2
name: Upload artifact
with:
name: ${{ env.BINARY_NAME }}_${{ env.VERSION }}_${{ env.BUILD_TARGET }}
path: target/${{ env.BUILD_TARGET }}/release/${{ env.BINARY_NAME }}
build_arch:
name: Arch Linux package
runs-on: ubuntu-latest
needs: ["build"]
container:
image: archlinux:base-devel
options: --user 1001
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Get version
run: echo "VERSION=$(grep -P '^version = \"\d+\.\d+\.\d+\"' Cargo.toml | awk -F '\"' '{print $2}')" >> $GITHUB_ENV
- uses: actions/download-artifact@master
name: Download
id: download_binary
with:
name: ${{ env.BINARY_NAME }}_${{ env.VERSION }}_${{ env.BUILD_TARGET }}
path: ${{ env.BINARY_NAME }}_${{ env.VERSION }}_${{ env.BUILD_TARGET }}
- name: Move binary
run: |
mkdir -p target/${{ env.BUILD_TARGET }}/release/
mv ${{ env.BINARY_NAME }}_${{ env.VERSION }}_${{ env.BUILD_TARGET }}/rexec target/${{ env.BUILD_TARGET }}/release/
- name: Build ZST package
run: |
makepkg -f
- uses: actions/upload-artifact@v2
name: Upload artifact
with:
name: ${{ env.BINARY_NAME }}_${{ env.VERSION }}_${{ env.BUILD_TARGET }}.zst
path: ${{ github.workspace }}/*zst
# release:
# name: Release binary
# needs: ["build"]
# runs-on: ubuntu-latest
# permissions:
# contents: write
# steps:
# - uses: actions/download-artifact@master
# id: download_binary
# with:
# name: ${{ env.BINARY_NAME }}_x86_64-linux-musl
# path: ${{ env.BINARY_NAME }}_x86_64-linux-musl
# - uses: actions/download-artifact@master
# id: download_pkgbuild
# with:
# name: PKGBUILD
# path: PKGBUILD
# - uses: ncipollo/release-action@v1
# name: Update release page
# with:
# artifacts: "${{ steps.download_binary.outputs.download-path }}/*"
# allowUpdates: true
# body: Static build for x86_64-linux using MUSL