Skip to content

Commit

Permalink
#build-minor: update GitHub Actions workflow for improved package man…
Browse files Browse the repository at this point in the history
…agement and versioning
  • Loading branch information
reskume committed Dec 30, 2024
1 parent eb1b9b1 commit 39186da
Showing 1 changed file with 37 additions and 50 deletions.
87 changes: 37 additions & 50 deletions .github/workflows/github-create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,86 +9,73 @@ jobs:
name: "Run tests"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# this is important to make sure that tokens are not reused in subsequent steps
# -> removeing this will cause the "GITHUB_TOKEN: ${{ secrets.AUTOMATOR_DEVOPS_PAT }}" to
# reuse the token from the previous step although defined otherwise
with:
persist-credentials: false
- uses: actions/setup-node@v3
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://npm.pkg.github.com/
scope: "@openaip"
- run: npm install
name: Install packages
env:
NODE_AUTH_TOKEN: ${{secrets.AUTOMATOR_DEVOPS_PAT}}
- run: npm run test
- 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:
- uses: actions/checkout@v4
# this is important to make sure that tokens are not reused in subsequent steps
# -> removeing this will cause the "GITHUB_TOKEN: ${{ secrets.AUTOMATOR_DEVOPS_PAT }}" to
# reuse the token from the previous step although defined otherwise
with:
persist-credentials: false
- uses: actions/setup-node@v3
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
scope: '@openaip'
- run: npm install
env:
NODE_AUTH_TOKEN: ${{secrets.AUTOMATOR_DEVOPS_PAT}}
- run: npm run build
env:
NODE_AUTH_TOKEN: ${{secrets.AUTOMATOR_DEVOPS_PAT}}
- id: bump-version
- 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
name: Bump package version
env:
GITHUB_TOKEN: ${{ secrets.AUTOMATOR_DEVOPS_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
major-wording: "#build-major"
minor-wording: "#build-minor"
patch-wording: "#build-patch"
# use "patch" as default bump strategy
default: patch
tag-prefix: "v"
- uses: actions/create-release@v1
name: Create release
- 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
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 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
# publish to GitHub Package Registry for internal use with @openaip namespace
- uses: actions/setup-node@v3
- name: Setup Node for publishing
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://npm.pkg.github.com/
scope: '@openaip'
- run: npm publish
name: Publish to GitHub Package Registry
env:
NODE_AUTH_TOKEN: ${{secrets.AUTOMATOR_DEVOPS_PAT}}
# publish to NPM for public access
- uses: actions/setup-node@v3
with:
node-version: 22
registry-url: https://registry.npmjs.org
scope: '@openaip'
- run: npm publish --access public
name: Publish to NPM Package Registry
- name: Publish to GitHub Package Registry
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.GHPR_TOKEN}}
permissions:
contents: write

0 comments on commit 39186da

Please sign in to comment.