Bump jest from 30.0.4 to 30.0.5 (#210) #118
This file contains hidden or 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: publish-npm | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: {} | |
| jobs: | |
| npm-publish: | |
| name: Publish to NPM & GitHub Package Registry | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| # id-token: write required for get-vault-secrets | |
| id-token: write | |
| outputs: | |
| new_version: ${{ steps.version_check.outputs.version }} | |
| version_changed: ${{ steps.version_check.outputs.changed }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| persist-credentials: false | |
| # limit releases to version changes - https://github.com/EndBug/version-check | |
| - name: Check version changes | |
| uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425 # v2.1.5 | |
| id: version_check | |
| with: | |
| file-url: https://unpkg.com/@grafana/aws-sdk@latest/package.json | |
| static-checking: localIsNew | |
| - name: Version update detected | |
| env: | |
| VERSION: ${{ steps.version_check.outputs.version }} | |
| TYPE: ${{ steps.version_check.outputs.type }} | |
| if: steps.version_check.outputs.changed == 'true' | |
| run: 'echo "Version change found! New version: ${VERSION} (${TYPE})"' | |
| - name: Setup .npmrc file for NPM registry | |
| if: steps.version_check.outputs.changed == 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| if: steps.version_check.outputs.changed == 'true' | |
| run: yarn | |
| - name: Build library | |
| if: steps.version_check.outputs.changed == 'true' | |
| run: yarn build | |
| - name: Get secrets from vault | |
| id: get-secrets | |
| uses: grafana/shared-workflows/actions/get-vault-secrets@main | |
| with: | |
| repo_secrets: | | |
| NPM_TOKEN=npm-release:npm_token | |
| - name: Publish package to NPM | |
| if: steps.version_check.outputs.changed == 'true' | |
| run: npm publish --access public --scope grafana | |
| env: | |
| NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }} | |
| - name: Setup .npmrc file for GitHub Packages | |
| if: steps.version_check.outputs.changed == 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| registry-url: 'https://npm.pkg.github.com' | |
| scope: '@grafana' | |
| - name: Publish package to Github Packages | |
| if: steps.version_check.outputs.changed == 'true' | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| create-github-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: npm-publish | |
| if: needs.npm-publish.outputs.version_changed == 'true' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Create Release Notes | |
| uses: actions/[email protected] | |
| env: | |
| TAG_NAME: "v${{ needs.npm-publish.outputs.new_version }}" | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const { TAG_NAME } = process.env | |
| await github.request(`POST /repos/${{ github.repository }}/releases`, { | |
| tag_name: `${TAG_NAME}`, | |
| generate_release_notes: true | |
| }); |