Skip to content

Publish Release

Publish Release #180

Workflow file for this run

name: Publish Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set PRE_LAST_GIT_TAG
run: |
git pull origin main --rebase --tags -f
git tag
echo "PRE_LAST_GIT_TAG=$(git tag --sort=version:refname | tail -2 | head -n 1)" >> $GITHUB_ENV
echo "DATE_FORMAT='%an%x09%s'" >> $GITHUB_ENV
- name: Set commits.txt
run: |
echo ${{ env.PRE_LAST_GIT_TAG }}
echo ${{ env.DATE_FORMAT }}
git log ${{ env.PRE_LAST_GIT_TAG }}..HEAD --oneline --pretty=format:${{ env.DATE_FORMAT }} >> changelogs/commits.txt
- name: Create CHANGELOG
run: |
cat changelogs/commits.txt
node ./bin/get-changelog.js "$(cat changelogs/commits.txt)"
- name: Show recently created changelog
run: |
cat changelogs/CHANGELOG.md
- uses: ncipollo/release-action@v1
with:
artifacts: 'release.tar.gz'
bodyFile: 'changelogs/CHANGELOG.md'
token: ${{ secrets.GITHUB_TOKEN }}
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v2
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}