Skip to content

Commit 195ef9f

Browse files
authored
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
1 parent 87acc19 commit 195ef9f

File tree

2 files changed

+48
-32
lines changed

2 files changed

+48
-32
lines changed

.github/workflows/npmpublish.yml

-32
This file was deleted.

.github/workflows/publish.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
name: Upload Release Asset
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
- name: Get tag
16+
id: get_version
17+
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
18+
- name: Create Zip Folder
19+
run: zip -r --junk-paths ${{ steps.get_version.outputs.VERSION }}.zip ./dist
20+
- name: Create Release
21+
id: create_release
22+
uses: actions/create-release@v1
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
with:
26+
tag_name: ${{ github.ref }}
27+
release_name: Release ${{ github.ref }}
28+
draft: false
29+
prerelease: false
30+
- name: Upload Release Asset
31+
id: upload-release-asset
32+
uses: actions/upload-release-asset@v1
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
upload_url: ${{ steps.create_release.outputs.upload_url }}
37+
asset_path: ./${{ steps.get_version.outputs.VERSION }}.zip
38+
asset_name: ${{ steps.get_version.outputs.VERSION }}.zip
39+
asset_content_type: application/zip
40+
- name: Setup Node
41+
uses: actions/setup-node@v1
42+
with:
43+
node-version: 12
44+
registry-url: https://registry.npmjs.org/
45+
- name: publish npm
46+
run: npm publish
47+
env:
48+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 commit comments

Comments
 (0)