BP-2473 📜 update to use gar #3
Workflow file for this run
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: "[PR] Build, check and publish" | |
on: | |
workflow_call: | |
secrets: | |
VERDACCIO_FORTO_IO_TOKEN: | |
required: true | |
token: | |
required: true | |
inputs: | |
publish-to-gar: | |
description: 'Boolean flag to control publishing flow' | |
required: false | |
default: false | |
type: boolean | |
gar-registry: | |
description: 'The registry to publish to' | |
required: false | |
default: npm-internal-release | |
type: string | |
env: | |
VERDACCIO_FORTO_IO_TOKEN: ${{ secrets.VERDACCIO_FORTO_IO_TOKEN }} | |
jobs: | |
pre-release: | |
name: Publish pre-release version | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.token }} | |
- name: 'Call Authentication Workflow' | |
uses: freight-hub/gh-workflows/.github/workflows/npm-auth.yml@main | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- name: bump-version-from-tag | |
id: tag | |
uses: freight-hub/[email protected] | |
with: | |
build_number: ${{ github.run_number }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
fallback_tag: 0.0.1 | |
# set the new_version on package.json | |
- run: yarn version --new-version ${{ steps.tag.outputs.new_version }} --no-git-tag-version | |
- name: commit-stable-version-change | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: 'Update package.json to next stable version' | |
# set the publish the release version | |
- run: yarn install --frozen-lockfile | |
- run: yarn build | |
- run: yarn version --new-version ${{ steps.tag.outputs.pre_release_version }} --no-git-tag-version | |
- run: yarn publish --tag ${{ steps.tag.outputs.pre_release_version }} | |
- name: Publish to npm | |
if: ${{ inputs.publish-to-gar }} | |
run: | | |
echo "//europe-west1-npm.pkg.dev/forto-artifacts/${{ inputs.gar-registry }}/:_authToken=${FORTO_ARTIFACTS_TOKEN}" >> .npmrc | |
yarn publish --registry https://europe-west1-npm.pkg.dev/forto-artifacts/${{ inputs.gar-registry }} --tag ${{ steps.tag.outputs.pre_release_version }} | |
- if: ${{ !inputs.publish-to-gar }} | |
run: | | |
echo "//verdaccio.forto.io/:_authToken=${VERDACCIO_FORTO_IO_TOKEN}" >> .npmrc | |
yarn publish --registry https://verdaccio.forto.io --tag ${{ steps.tag.outputs.pre_release_version }} | |