Skip to content

v3.2.0

v3.2.0 #2

Workflow file for this run

name: Release and Publish
on:
release:
types:
- released
permissions:
contents: write
actions: write
checks: write
id-token: write
jobs:
Test:
uses: ./.github/workflows/action-test.yaml
Strip_Version:
runs-on: ubuntu-latest
outputs:
CLEAN_TAG: ${{ steps.set-output.outputs.CLEAN_TAG }}
steps:
- name: Strip "v" from Tag
id: set-output
run: echo "CLEAN_TAG=${GITHUB_EVENT_RELEASE_TAG_NAME#v}" >> $GITHUB_OUTPUT
env:
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
Publish:
runs-on: ubuntu-latest
outputs:
GIT_BRANCH_TARGET: ${{ steps.set-npm-tag.outputs.GIT_BRANCH_TARGET }}
needs: ['Test', 'Strip_Version']
env:
CLEAN_TAG: ${{ needs.Strip_Version.outputs.CLEAN_TAG }}
steps:
- name: Create Directory
run: mkdir -p ./lib
- name: Download the build artifact
uses: actions/download-artifact@v4
with:
name: cache
path: ./
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: 'https://registry.npmjs.org/'
- name: Update Version in Package.json
id: set-npm-tag
run: |
npm version $CLEAN_TAG --no-git-tag-version
if [[ "$CLEAN_TAG" == *"beta"* ]]; then
echo "NPM_TAG=beta" >> $GITHUB_OUTPUT
echo "GIT_BRANCH_TARGET=develop" >> $GITHUB_OUTPUT
else
echo "NPM_TAG=latest" >> $GITHUB_OUTPUT
echo "GIT_BRANCH_TARGET=main" >> $GITHUB_OUTPUT
fi
- name: Publish to npm
uses: JS-DevTools/npm-publish@v3
with:
provenance: true
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ steps.set-npm-tag.outputs.NPM_TAG }}
Update_Repo:
runs-on: ubuntu-latest
needs: ['Test', 'Strip_Version', 'Publish']
permissions:
contents: write
actions: write
checks: write
env:
CLEAN_TAG: ${{ needs.Strip_Version.outputs.CLEAN_TAG }}
GIT_BRANCH_TARGET: ${{ needs.Publish.outputs.GIT_BRANCH_TARGET }}
steps:
# - uses: hmarr/debug-action@v3
- uses: actions/checkout@v4
with:
token: '${{ secrets.GITHUB_TOKEN }}'
ref: ${{ env.GIT_BRANCH_TARGET }}
sparse-checkout: |
package.json
CHANGELOG.md
sparse-checkout-cone-mode: false
- name: Update Version in Package.json
id: set-git-branch
run: npm version $CLEAN_TAG --no-git-tag-version
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}
- name: Commit and Push Version Update
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore(release): ${{ github.event.release.tag_name }} [skip ci]"
Document:
needs: ['Update_Repo', 'Publish']
uses: ./.github/workflows/action-docs.yaml