build: add release workflow

This commit is contained in:
Louis Lin 2021-01-22 09:55:32 +01:00
parent 7f3a599f6a
commit aa88c3e221
4 changed files with 45 additions and 2 deletions

View File

@ -24,6 +24,6 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: npm install run: npm install
- name: Run a one-line script - name: Run build
run: npm run build run: npm run build

40
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: publish
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install
- name: Run build
run: npm run build
- name: Publish to NPM packages
# includes a --ignore-scripts command argument to avoid executing npm life cycle scripts during this phase
# for security concerns
run: npm publish --ignore-scripts --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v1
with:
registry-url: 'https://npm.pkg.github.com'
- name: Publish to Github packages
run: npm publish --ignore-scripts --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ bin
.zedstate .zedstate
tags tags
dist dist
build

View File

@ -28,6 +28,8 @@
"generate:banner": "node scripts/generate_banner.js build/banner.css", "generate:banner": "node scripts/generate_banner.js build/banner.css",
"init:folders": "mkdir -p build && mkdir -p dist", "init:folders": "mkdir -p build && mkdir -p dist",
"transform": "myth src/font-awesome-animation.css build/$npm_package_name.css --sourcemap", "transform": "myth src/font-awesome-animation.css build/$npm_package_name.css --sourcemap",
"transform:compress": "myth src/font-awesome-animation.css build/$npm_package_name.min.css --sourcemap --compress" "transform:compress": "myth src/font-awesome-animation.css build/$npm_package_name.min.css --sourcemap --compress",
"version": "npm run build",
"postversion": "git push && git push --tags"
} }
} }