From aec5ddc1021cccc1647c5554f9e578529ebf3783 Mon Sep 17 00:00:00 2001 From: Sergii Mikhtoniuk Date: Sat, 5 Sep 2020 17:49:14 -0700 Subject: [PATCH] Release script tweaks --- .github/workflows/release.yaml | 147 ++++++++++++++++----------------- 1 file changed, 73 insertions(+), 74 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1edd9c83cd..573ad9b6fa 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,9 +1,8 @@ name: release -#on: -# push: -# tags: -# - v[0-9]+.[0-9]+.[0-9]+* -on: [push] +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+* env: PACKAGE_NAME: kamu-cli jobs: @@ -63,72 +62,72 @@ jobs: name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }} path: target/${{ matrix.target }}/release/${{ env.PACKAGE_NAME }}.exe if-no-files-found: error - # create_release: - # name: Create Release - # runs-on: ubuntu-latest - # needs: [build_linux, build_macos, build_windows] - # steps: - # - name: Create Release - # id: create_release - # uses: actions/create-release@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # tag_name: ${{ github.ref }} - # release_name: Release ${{ github.ref }} - # draft: false - # prerelease: false - # outputs: - # upload_url: ${{ steps.create_release.outputs.upload_url }} - # upload_assets_targz: - # name: Upload Assets (tar.gz) - # runs-on: ubuntu-latest - # needs: [create_release] - # strategy: - # matrix: - # target: - # - x86_64-unknown-linux-gnu - # - x86_64-unknown-linux-musl - # - x86_64-apple-darwin - # steps: - # - name: Download Artifact - # uses: actions/download-artifact@v2 - # with: - # name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }} - # path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }} - # - name: Compress Artifacts - # run: tar -czvf ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.tar.gz ${{ env.PACKAGE_NAME }}-${{ matrix.target }} - # - name: Upload Asset - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create_release.outputs.upload_url }} - # asset_path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.tar.gz - # asset_name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.tar.gz - # asset_content_type: application/gzip - # upload_assets_zip: - # name: Upload Assets (zip) - # runs-on: ubuntu-latest - # needs: [create_release] - # strategy: - # matrix: - # target: - # - x86_64-pc-windows-msvc - # steps: - # - name: Download Artifact - # uses: actions/download-artifact@v2 - # with: - # name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }} - # path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }} - # - name: Compress Artifacts - # run: zip -r ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.zip ${{ env.PACKAGE_NAME }}-${{ matrix.target }} - # - name: Upload Asset - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create_release.outputs.upload_url }} - # asset_path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.zip - # asset_name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.zip - # asset_content_type: application/gzip + create_release: + name: Create Release + runs-on: ubuntu-latest + needs: [build_linux, build_macos, build_windows] + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_assets_targz: + name: Upload Assets (tar.gz) + runs-on: ubuntu-latest + needs: [create_release] + strategy: + matrix: + target: + - x86_64-unknown-linux-gnu + - x86_64-unknown-linux-musl + - x86_64-apple-darwin + steps: + - name: Download Artifact + uses: actions/download-artifact@v2 + with: + name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }} + path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }} + - name: Compress Artifacts + run: tar -czvf ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.tar.gz ${{ env.PACKAGE_NAME }}-${{ matrix.target }} + - name: Upload Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.tar.gz + asset_name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.tar.gz + asset_content_type: application/gzip + upload_assets_zip: + name: Upload Assets (zip) + runs-on: ubuntu-latest + needs: [create_release] + strategy: + matrix: + target: + - x86_64-pc-windows-msvc + steps: + - name: Download Artifact + uses: actions/download-artifact@v2 + with: + name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }} + path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }} + - name: Compress Artifacts + run: zip -r ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.zip ${{ env.PACKAGE_NAME }}-${{ matrix.target }} + - name: Upload Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.zip + asset_name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.zip + asset_content_type: application/gzip