From b3c132370d07687c8b5d9bd91a811cffd984317b Mon Sep 17 00:00:00 2001 From: dark0dave Date: Fri, 21 Apr 2023 00:57:58 +0100 Subject: [PATCH] fix(release): Fix workflow call Signed-off-by: dark0dave --- .github/workflows/build.yml | 30 +++++++++++++++-- .github/workflows/release.yml | 62 ----------------------------------- 2 files changed, 28 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e986e23..c29d3c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,10 @@ name: Build on: - push: - branches: [main] pull_request: + push: + tags: + - 'v*' env: CARGO_TERM_COLOR: always @@ -81,3 +82,28 @@ jobs: path: | target/${{matrix.target}}/release/mod_installer* if-no-files-found: error + create-release: + permissions: write-all + needs: [build-windows, build-macos, build-linux] + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@v3 + - name: Get the tag + id: get_tag + run: echo ::set-output name=git_tag::${GITHUB_REF/refs\/tags\//} + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: release/ + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + with: + fail_on_unmatched_files: true + files: release/* + tag_name: ${{ steps.get_tag.outputs.git_tag }} + generate_release_notes: true + draft: ${{ startsWith(steps.get_tag.outputs.git_tag, 'nightly') != true }} + prerelease: ${{ startsWith(steps.get_tag.outputs.git_tag, 'nightly') }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 04c9615..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Release - -permissions: - contents: write - -env: - CARGO_TERM_COLOR: always - -on: - push: - tags: - - v[0-9]+.* - -jobs: - build: - uses: ./.github/workflows/build.yml - create-release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Get the tag - id: get_tag - run: echo ::set-output name=git_tag::${GITHUB_REF/refs\/tags\//} - - name: "✏️ Generate release changelog" - id: changelog - uses: heinrichreimer/github-changelog-generator-action@v2.3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.get_tag.outputs.git_tag }} - release_name: ${{ steps.get_tag.outputs.git_tag }} - body: ${{ steps.changelog.outputs.changelog }} - draft: ${{ startsWith(steps.get_tag.outputs.git_tag, 'nightly') != true }} - prerelease: ${{ startsWith(steps.get_tag.outputs.git_tag, 'nightly') }} - release-artifacts: - name: Release Artifacts - runs-on: ubuntu-latest - strategy: - matrix: - os: - - aarch64-unknown-linux-gnu - - x86_64-unknown-linux-gnu - - x86_64-apple-darwin - - aarch64-apple-darwin - - windows-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 - with: - name: mod_installer-${{ matrix.os }} - - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: mod_installer-${{ matrix.os }} - asset_content_type: application/zip