#build-minor: build config #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create NPM package | |
on: | |
push: | |
jobs: | |
run-tests: | |
# only run if specific '#build' tag is found in commit message | |
if: contains(github.event.head_commit.message, '#build') | |
name: "Run tests" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Clear npm cache | |
run: npm cache clean --force | |
- name: Configure .npmrc | |
run: | | |
echo "${{secrets.NPMRC}}" >> ~/.npmrc | |
- name: Install packages | |
run: npm install | |
- name: Run tests | |
run: npm run test | |
publish: | |
name: "Build and publish package" | |
needs: run-tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Clear npm cache | |
run: npm cache clean --force | |
- name: Configure .npmrc | |
run: | | |
echo "${{secrets.NPMRC}}" >> ~/.npmrc | |
- name: Install packages | |
run: npm install | |
- name: NPM build package | |
run: npm run build | |
- name: Bump package version | |
id: bump-version | |
uses: phips28/gh-action-bump-version@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTOMATOR_DEVOPS_PAT }} | |
with: | |
major-wording: "#build-major" | |
minor-wording: "#build-minor" | |
patch-wording: "#build-patch" | |
# use "patch" as default bump strategy | |
default: patch | |
tag-prefix: "v" | |
- name: Create release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTOMATOR_DEVOPS_PAT }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{steps.bump-version.outputs.newTag}} | |
release_name: Release ${{steps.bump-version.outputs.newTag}} | |
body: | | |
Various fixes and performance improvements. | |
draft: false | |
prerelease: false | |
- name: Setup Node for publishing to GitHub Package Registry | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@openaip' | |
- name: Publish to GitHub Package Registry | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GHPR_TOKEN}} | |
- name: Setup Node for publishing to NPM registry | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
registry-url: https://registry.npmjs.org | |
scope: '@openaip' | |
- name: Publish to NPM Package Registry | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
permissions: | |
contents: write |