From fcfbfff48223162da06905c46f06b48977810e6f Mon Sep 17 00:00:00 2001 From: Kazuya Takei Date: Fri, 3 Dec 2021 19:09:12 +0900 Subject: [PATCH] Release packages on tagged --- .github/workflows/release.yml | 91 +++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) 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..1e948bd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,91 @@ +name: Release packages + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: Create release on GitHub + id: create_release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: ${{ github.ref_name }} + body: TBD + draft: false + prerelease: false + build: + needs: release + runs-on: ${{ matrix.vm }} + strategy: + matrix: + include: + - name: linux + vm: ubuntu-latest + - name: macosx + vm: macos-latest + - name: windows + vm: windows-latest + steps: + - uses: actions/checkout@v1 + - name: Cache choosenim + id: cache_choosenim + uses: actions/cache@v1 + with: + path: ~/.choosenim + key: choosenim-${{ matrix.vm }} + - name: Cache nimble + id: cache_nimble + uses: actions/cache@v1 + with: + path: ~/.nimble + key: nimble-${{ matrix.vm }} + - uses: jiro4989/setup-nim-action@v1 + with: + nim-version: 1.6.0 + - name: Run main + run: | + nimble build -d:release -Y + nimble bundle + - name: Package(unix) + if: runner.os != 'Windows' + uses: thedoctor0/zip-release@master + with: + type: tar + directory: dist/ + filename: ../gigi-${{ github.ref_name }}_${{ matrix.name }}.tar.gz + - name: Package(win) + if: runner.os == 'Windows' + uses: thedoctor0/zip-release@master + with: + type: zip + directory: dist/ + filename: ../gigi-${{ github.ref_name }}_${{ matrix.name }}.zip + - name: Upload to release(unix) + if: runner.os != 'Windows' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: gigi-${{ github.ref_name }}_${{ matrix.name }}.tar.gz + asset_name: gigi-${{ github.ref_name }}_${{ matrix.name }}.tar.gz + asset_content_type: application/gzip + - name: Upload to release(win) + if: runner.os == 'Windows' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: gigi-${{ github.ref_name }}_${{ matrix.name }}.zip + asset_name: gigi-${{ github.ref_name }}_${{ matrix.name }}.zip + asset_content_type: application/zip