use context instead #2
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
# Release a tagged version of the '@elastic/opentelemetry-node' package. | |
name: release | |
on: | |
push: | |
tags: | |
- v*.*.* | |
branches: | |
- main | |
- trentm/release-process | |
# 'id-token' perm needed for npm publishing with provenance (see | |
# https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow) | |
permissions: | |
contents: write | |
pull-requests: read | |
id-token: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
DRY_RUN: "${{ ! startsWith(github.ref, 'refs/tags') }}" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'v18.20.2' | |
- run: npm ci --ignore-scripts | |
- name: GitHub release | |
run: ./scripts/github-release.sh "packages/opentelemetry-node" "${{ github.ref_name }}" "${{ env.DRY_RUN }}" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Read NPM vault secrets | |
uses: hashicorp/vault-action@v3.0.0 | |
with: | |
url: ${{ secrets.VAULT_ADDR }} | |
method: approle | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
secrets: | | |
secret/jenkins-ci/npmjs/elasticmachine token | NPMJS_TOKEN ; | |
totp/code/npmjs-elasticmachine code | TOTP_CODE | |
- name: npm publish | |
run: | | |
PUBLISH_FLAGS="--dry-run" | |
[ "${{ env.DRY_RUN }}" == "true" ] && PUBLISH_FLAGS="" || true | |
echo "npm publish $PUBLISH_FLAGS --otp=${{ env.TOTP_CODE }}" | |
env: | |
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry | |
NODE_AUTH_TOKEN: ${{ env.NPMJS_TOKEN }} | |
# If a release tag then notify | |
- if: ${{ always() && startsWith(github.ref, 'refs/tags') }} | |
uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current | |
with: | |
vaultUrl: ${{ secrets.VAULT_ADDR }} | |
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} | |
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} | |
slackChannel: "#apm-agent-node" | |
message: '[${{ github.repository }}] Release `@elastic/opentelemetry-node` *${{ github.ref_name }}*' | |