From 71a6bf6fa6c9304d823013014593e226c519770f Mon Sep 17 00:00:00 2001 From: Patrick Kerwood Date: Sun, 14 Nov 2021 18:49:40 +0100 Subject: [PATCH] Added build config --- .github/workflows/build-n-release.yml | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/build-n-release.yml diff --git a/.github/workflows/build-n-release.yml b/.github/workflows/build-n-release.yml new file mode 100644 index 0000000..c3aff52 --- /dev/null +++ b/.github/workflows/build-n-release.yml @@ -0,0 +1,56 @@ +name: Build and Release + +on: + push: + branches: + - '!*' + tags: + - 'v*' + +env: + CARGO_TERM_COLOR: always + app-name: 'confluence-updater' + +jobs: + rustfmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: rustup component add rustfmt + - run: cargo fmt -- --check + + build-linux: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Cache Rust dependencies + uses: actions/cache@v1.0.1 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build- + - name: Install latest rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: beta + default: true + override: true + + - name: Build + run: | + sudo apt update && sudo apt install musl-tools + rustup target add x86_64-unknown-linux-musl + cargo build --release --target x86_64-unknown-linux-musl + strip target/x86_64-unknown-linux-musl/release/${{ env.app-name }} + mv target/x86_64-unknown-linux-musl/release/${{ env.app-name }} target/x86_64-unknown-linux-musl/release/${{ env.app-name }}-x86_64-unknown-linux-musl + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: target/x86_64-unknown-linux-musl/release/${{ env.app-name }}-x86_64-unknown-linux-musl + asset_name: ${{ env.app-name }}-x86_64-unknown-linux-musl + tag: ${{ github.ref }} + overwrite: true