From d58ac0faee89b7e54e20ee7274f5c64ca0cc7b7b Mon Sep 17 00:00:00 2001 From: Pierre Dubouilh Date: Sat, 1 Feb 2025 12:15:20 +0200 Subject: [PATCH] build & release on gh --- .github/workflows/always.yml | 37 ++++++++++++++++++++++ .github/workflows/{rust.yml => deploy.yml} | 11 ++----- .gitignore | 1 + Makefile | 7 ++++ 4 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/always.yml rename .github/workflows/{rust.yml => deploy.yml} (64%) diff --git a/.github/workflows/always.yml b/.github/workflows/always.yml new file mode 100644 index 0000000..1b252eb --- /dev/null +++ b/.github/workflows/always.yml @@ -0,0 +1,37 @@ +name: deploy + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run tests + run: make ci + + - name: Build all artifacts + run: make build-all + + - name: "Release gh release versioned" + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "builds/*" + bodyFile: "builds/buildout" + token: ${{ secrets.GITHUB_TOKEN }} + + - name: "Release gh release latest" + uses: ncipollo/release-action@v1 + with: + tag: latest + name: Latest + allowUpdates: true + artifacts: "builds/*" + bodyFile: "builds/buildout" + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/rust.yml b/.github/workflows/deploy.yml similarity index 64% rename from .github/workflows/rust.yml rename to .github/workflows/deploy.yml index 40cbc19..6654d37 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/deploy.yml @@ -1,19 +1,12 @@ -name: Rust - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] +name: always +on: [push] env: CARGO_TERM_COLOR: always jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - name: Run CI diff --git a/.gitignore b/.gitignore index ea8c4bf..486967d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +builds/** diff --git a/Makefile b/Makefile index 0271198..3962a8b 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,13 @@ ci:: test cargo fmt --all -- --check cargo clippy -- -D warnings +build-all:: + cargo build --target x86_64-unknown-linux-musl --release + mkdir -p builds + cp target/x86_64-unknown-linux-musl/release/blockfast builds + rustc --version > builds/buildout + sha256sum builds/blockfast >> builds/buildout + publish:: ci cargo publish