From 195ef9fc3efdce3cf944aaf8eea4a0c579630079 Mon Sep 17 00:00:00 2001 From: Rob Larsen Date: Mon, 11 May 2020 13:59:52 -0400 Subject: [PATCH] Creates new publish action (#2241) When a tag is created and pushed to GitHub, this action will - create the zip folder for the release - creates the release - adds the zip folder to the release - publishes to npm closes #2181 --- .github/workflows/npmpublish.yml | 32 --------------------- .github/workflows/publish.yaml | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 32 deletions(-) delete mode 100644 .github/workflows/npmpublish.yml create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml deleted file mode 100644 index 0e025b4037..0000000000 --- a/.github/workflows/npmpublish.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: publish npm - -on: - release: - types: [published] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 12 - - run: npm ci - - run: npm run build - - publish-npm: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 12 - registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} - - diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000000..99e5da2bfd --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,48 @@ +name: publish + +on: + push: + tags: + - 'v*' + +jobs: + build: + name: Upload Release Asset + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Get tag + id: get_version + run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + - name: Create Zip Folder + run: zip -r --junk-paths ${{ steps.get_version.outputs.VERSION }}.zip ./dist + - 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 + - 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: ./${{ steps.get_version.outputs.VERSION }}.zip + asset_name: ${{ steps.get_version.outputs.VERSION }}.zip + asset_content_type: application/zip + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - name: publish npm + run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}}