Skip to content

Commit

Permalink
chore(workflow): improve deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
derevnjuk committed Jun 4, 2020
1 parent 84627f7 commit f30389c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
token: ${{ secrets.GPR_TOKEN }}
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm ci -q
- run: npm run lint
- run: npm run pretty
- run: npm run build
47 changes: 28 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,50 @@ name: Automated deploy

on:
push:
branches:
- master
tags:
- 'v*'

jobs:
release:
prepare:
runs-on: ubuntu-latest
outputs:
project_version: ${{ steps.project_version.outputs.value }}
project: ${{ steps.project.outputs.value }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm ci
- run: npm run build
- run: npm run semantic-release
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- id: project_version
run: echo ::set-output name=value::${GITHUB_REF/refs\/tags\//}
- id: project
run: echo ::set-output name=value::$(echo ${GITHUB_REPOSITORY#*/} | tr A-Z a-z)

deploy:
needs: release
runs-on: ubuntu-latest
needs: prepare
env:
PROJECT: ${{ needs.prepare.outputs.project }}
VERSION: ${{ needs.prepare.outputs.project_version }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
token: ${{ secrets.GPR_TOKEN }}

- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm version from-git
- run: npm ci
registry-url: 'https://registry.npmjs.org'

- run: npm ci -q
- run: npm run build
- run: npm version --no-git-tag-version "$VERSION"
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: 'https://npm.pkg.github.com'
scope: '@NeuraLegion'

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GPR_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Semantic release

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GPR_TOKEN }}
- uses: actions/setup-node@v1
with:
node-version: 12

- name: Semantic release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}

0 comments on commit f30389c

Please sign in to comment.