From 2a33e56096d9d4ca359150593cc1fd5d2fc043e2 Mon Sep 17 00:00:00 2001 From: kwt <4344285+kwtalley@users.noreply.github.com> Date: Mon, 29 Apr 2024 15:34:49 -0500 Subject: [PATCH] add release github workflow and cleanup --- .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 7 +++-- 2 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4897354 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: provwasm-test-tube release + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 + - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 + - "v[0-9]+.[0-9]+.[0-9]+-beta*" # Push events to matching v*, i.e. v1.0.0-beta2 + +jobs: + # This action cleans up previously running instances of a workflow on the same branch. This accomplishes + # the task of automatically cancelling CI runs on pushes to the same branch, which is a common feature in + # most CI systems but currently not possible with GitHub actions. + cleanup_runs: + name: Cleanup Workflows + runs-on: ubuntu-latest + steps: + - uses: rokroskar/workflow-run-cleanup-action@v0.3.3 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'" + + build_test: + name: Build and Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up cargo cache + uses: Swatinem/rust-cache@v2 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + + create_release: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Create release + uses: softprops/action-gh-release@v1 + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: ${{ github.ref_name }} + draft: true + prerelease: false + body_path: RELEASE_CHANGELOG.md + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d97442..89afb09 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,7 @@ jobs: # the task of automatically cancelling CI runs on pushes to the same branch, which is a common feature in # most CI systems but currently not possible with GitHub actions. cleanup-runs: + name: Cleanup Workflows runs-on: ubuntu-latest steps: - uses: rokroskar/workflow-run-cleanup-action@v0.3.3 @@ -20,16 +21,14 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'" - build: + build_test: + name: Build and Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up cargo cache uses: Swatinem/rust-cache@v2 - - name: Build run: cargo build --verbose - - name: Run tests run: cargo test --verbose \ No newline at end of file