Skip to content

Commit

Permalink
Creates new publish action (#2241)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
roblarsen committed May 11, 2020
1 parent 87acc19 commit 195ef9f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 32 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/npmpublish.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .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}}

0 comments on commit 195ef9f

Please sign in to comment.