Skip to content

release

release #14

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
is-stack-release:
type: boolean
description: Should we tag the current version as a stack release?
required: true
default: false
dry-run:
type: boolean
description: "Should we run in dry-run mode?"
required: true
default: false
permissions:
contents: write # needed to push the tag and create the release
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: elastic/apm-pipeline-library/.github/actions/setup-git@current
- uses: elastic/apm-pipeline-library/.github/actions/setup-npmrc@current
with:
secret: secret/jenkins-ci/npmjs/elasticmachine
vault-url: ${{ secrets.VAULT_ADDR }}
vault-role-id: ${{ secrets.VAULT_ROLE_ID }}
vault-secret-id: ${{ secrets.VAULT_SECRET_ID }}
- run: npm ci # runs npm prepublish
- uses: ./.github/actions/setup-totp
with:
vault-url: ${{ secrets.VAULT_ADDR }}
vault-role-id: ${{ secrets.VAULT_ROLE_ID }}
vault-secret-id: ${{ secrets.VAULT_SECRET_ID }}
- run: npx semantic-release --dry-run="${DRY_RUN}"
env:
DRY_RUN: ${{ github.event.inputs.dry-run }}
GITHUB_TOKEN: ${{ github.token }}
- name: Get version and package name
run: |
echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
echo "NPM_PACKAGE=$(jq -r '.name' package.json)" >> $GITHUB_ENV
- name: Create 'stack_release' dist-tag
if: ${{ github.event.inputs.dry-run == 'false' && github.event.inputs.is-stack-release == 'true' }}
run: npm dist-tag --otp=${TOTP_CODE} add "${NPM_PACKAGE}@${VERSION}" stack_release
- if: ${{ always() && github.event.inputs.dry-run == 'false' }}
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: "#synthetics-user_experience-uptime"