terraform-provider: v0.128.6 #190
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
on: | |
release: | |
types: [published] | |
name: api-release-npm | |
jobs: | |
check-api-released: | |
runs-on: [ARM64, self-hosted, Linux] | |
steps: | |
- name: Check Release | |
id: api_released | |
uses: actions/github-script@v5 | |
with: | |
result-encoding: string | |
script: return context.ref.includes('refs/tags/api-v') | |
outputs: | |
api_released: ${{ steps.api_released.outputs.result }} | |
publish-npm-package: | |
runs-on: [ARM64, self-hosted, Linux] | |
if: ${{ needs.check-api-released.outputs.api_released == 'true' }} | |
needs: | |
- check-api-released | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
registry-url: 'https://npm.pkg.github.com' | |
cache-dependency-path: api/package-lock.json | |
- name: Parse Version | |
id: parse_version | |
uses: actions/github-script@v5 | |
with: | |
result-encoding: string | |
script: return context.ref.replace('refs/tags/api-', '') | |
- run: sudo apt-get install jq | |
- name: Inject version into package.json | |
working-directory: api | |
run: | | |
PACKAGE_JSON=$(cat package.json | jq '.version = "${{ steps.parse_version.outputs.result }}"') | |
echo $PACKAGE_JSON | |
echo $PACKAGE_JSON > package.json | |
- name: Publish package | |
working-directory: api | |
run: | | |
npm install | |
npm run build | |
npm pack | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} |