From 18f7cf3190a782f48183cc5110d8cfaa5eedb307 Mon Sep 17 00:00:00 2001 From: Filipe Veloso Date: Mon, 19 Feb 2024 22:45:26 -0300 Subject: [PATCH] add release in CI with if --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ .github/workflows/release.yml | 30 ------------------------------ 2 files changed, 24 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77b1138..08f1e00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,3 +47,27 @@ jobs: with: name: ${{ matrix.target }} path: target/${{ matrix.target }}/release/ + + release: + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'Merge') }} + name: Release + needs: build + runs-on: ubuntu-latest + steps: + - name: Download Artifact + uses: actions/download-artifact@v4 + - name: Display structure of downloaded files + run: ls -R + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Create a GitHub release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.tag_version.outputs.new_tag }} + name: Release ${{ steps.tag_version.outputs.new_tag }} + artifacts: | + target/* + body: ${{ steps.tag_version.outputs.changelog }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 5b87dc6..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Tag and Release -on: - workflow_run: - workflows: ["Rust Multi-Arch Build"] - types: [completed] - branches: - - main -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Download Artifact - uses: actions/download-artifact@v4 - - name: Display structure of downloaded files - run: ls -R - - name: Bump version and push tag - id: tag_version - uses: mathieudutour/github-tag-action@v6.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - name: Create a GitHub release - uses: ncipollo/release-action@v1 - with: - tag: ${{ steps.tag_version.outputs.new_tag }} - name: Release ${{ steps.tag_version.outputs.new_tag }} - artifacts: | - target/* - body: ${{ steps.tag_version.outputs.changelog }} \ No newline at end of file