Skip to content

3.6.0

3.6.0 #156

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Package
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
#permissions:
#contents: read
#packages: write
steps:
- uses: actions/checkout@v2
#with:
#persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
#fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Setup node file to publish to npm
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Update changelog
run: |
x=`printf "### ${{ github.event.release.name }} \n"; echo "${{ github.event.release.body }}"; printf '\n\n'; cat CHANGELOG.md`
echo "$x" > CHANGELOG.md
- name: Commit files
#if: false == true
id: commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "github-actions"
git add --all
if [ -z "$(git status --porcelain)" ]; then
echo "::set-output name=push::false"
else
git commit -m "Updated Changelog" -a
echo "::set-output name=push::true"
fi
- name: Update Package Version
run: |
git config --local user.email "[email protected]"
git config --local user.name "github-actions"
git add --all
(npm version ${{ github.event.release.tag_name }} && git tag -d v${{ github.event.release.tag_name }}) || echo version not changed
- name: Push changes
#if: steps.commit.outputs.push == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Dependencies
run: npm install
- name: Publish Beta to npm
if: github.event.release.prerelease == true
run: npm publish --tag=beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to npm
if: github.event.release.prerelease == false
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}