Update GitHub Actions workflow for versioning

This commit is contained in:
Roger Veciana 2024-01-27 09:47:49 +01:00
parent 18555bfa28
commit 4e7fa5720b

View file

@ -12,13 +12,15 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
token: ${{secrets.PAT}} # use a personal acces token so that other actions can trigger
persist-credentials: true # This allows the use of GITHUB_TOKEN
fetch-depth: 0 # Fetch all history for all tags and branches
token: ${{secrets.GITHUB_TOKEN}} # Use GITHUB_TOKEN for checkout
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "14.x" # You might need to adjust this value to your own version
node-version: "14.x" # Adjust node version as needed
- name: Update version
id: version
run: |
@ -26,23 +28,23 @@ jobs:
git config --local user.name "GitHub Action"
npm version ${{ github.event.inputs.type }}
echo "::set-output name=tag::$(git describe --abbrev=0)"
# update the manifest.json with the tag version
- name: Update manifest version
uses: jossef/action-set-json-field@v1
with:
file: manifest.json
field: version
value: ${{ steps.version.outputs.tag }}
- name: Commit manifest
run: |
git branch --show-current
git add -u
git commit --amend --no-edit
git tag -fa ${{ steps.version.outputs.tag }} -m "${{ steps.version.outputs.tag }}"
# push the commit
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{secrets.PAT}}
github_token: ${{secrets.GITHUB_TOKEN}} # Use GITHUB_TOKEN for push
tags: true
branch: ${{ github.ref }}
branch: ${{ github.ref }}