From ecc143325fea0f916c5d8fe13d32f64e629e880f Mon Sep 17 00:00:00 2001 From: blenderskool Date: Thu, 19 Nov 2020 14:16:03 +0530 Subject: [PATCH] Update CI --- .github/workflows/release.yml | 56 +++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4acf6aa..f9f2a28 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,16 +7,10 @@ on: name: Create Release jobs: - build: + release: name: Create Release runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x] - browser: [chrome, firefox] steps: - - name: Checkout code - uses: actions/checkout@v2 - name: Create Release id: create_release uses: actions/create-release@v1 @@ -27,24 +21,60 @@ jobs: release_name: Release ${{ github.ref }} draft: false prerelease: false + - name: Output Release URL file + run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt + - name: Save Release URL File for publish + uses: actions/upload-artifact@v1 + with: + name: release_url + path: release_url.txt + + build: + name: Create Release + needs: [release] + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x] + browser: [chrome, firefox] + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Load Release URL File from release job + uses: actions/download-artifact@v1 + with: + name: release_url + - name: Get Release File Name & Upload URL + id: get_release_info + run: | + echo ::set-output name=file_name::${REPOSITORY_NAME##*/}-${TAG_REF_NAME##*/v} + value=`cat release_url/release_url.txt` + echo ::set-output name=upload_url::$value + env: + TAG_REF_NAME: ${{ github.ref }} + REPOSITORY_NAME: ${{ github.repository }} + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - run: npm install - run: BROWSER_ENV=${{ matrix.browser }} npm run build - - name: Set env - run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/} - - run: mv dist untab-${{ env.RELEASE_VERSION }}-${{ matrix.browser }} && zip -r untab-${{ env.RELEASE_VERSION }}-${{ matrix.browser }}.zip untab-${{ env.RELEASE_VERSION }}-${{ matrix.browser }} /* + - name: Set output + id: vars + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + + - run: mv dist untab-${{ steps.vars.outputs.tag }}-${{ matrix.browser }} && zip -r untab-${{ steps.vars.outputs.tag }}-${{ matrix.browser }}.zip untab-${{ steps.vars.outputs.tag }}-${{ matrix.browser }}/* + - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./untab-${{ env.RELEASE_VERSION }}-${{ matrix.browser }}.zip - asset_name: untab-${{ env.RELEASE_VERSION }}-${{ matrix.browser }}.zip + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./untab-${{ steps.vars.outputs.tag }}-${{ matrix.browser }}.zip + asset_name: untab-${{ steps.vars.outputs.tag }}-${{ matrix.browser }}.zip asset_content_type: application/zip