Skip to content

Commit

Permalink
feat: better release actions
Browse files Browse the repository at this point in the history
  • Loading branch information
simonecorsi committed Oct 8, 2021
1 parent 5c41107 commit 43b445d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 36 deletions.
41 changes: 5 additions & 36 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,27 @@
name: Publish workflow
name: NPM Publish

on:
push:
branches: master
release:
types: [published]

jobs:
test:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
registry-url: https://registry.npmjs.org/
node-version: 14
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: bahmutov/npm-install@v1
- run: npm t

version:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: bahmutov/npm-install@v1
- run: npm run build

- name: Bump version and push tag
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
preset: 'conventionalcommits'
github-token: ${{ secrets.GITHUB_TOKEN }}
git-message: 'chore(release): {version} [skip ci]'
tag-prefix: ''

- name: NPM Publish
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.npm_token }}
access: 'public'

- name: Create github Release
uses: actions/create-release@master
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.changelog }}
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
push:
branches: master

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: bahmutov/npm-install@v1
- run: npm t

version:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: bahmutov/npm-install@v1
- run: npm run build

- name: Bump version and push tag
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
preset: 'conventionalcommits'
github-token: ${{ secrets.GITHUB_TOKEN }}
git-message: 'chore(release): {version} [skip ci]'
git-user-name: 'Simone Corsi'
git-user-email: 'simonecorsi.dev@gmail.com'
tag-prefix: ''

- name: Create github Release
uses: actions/create-release@master
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.changelog }}

0 comments on commit 43b445d

Please sign in to comment.