Skip to content

release

release #39

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:
id-token: write # to enable use of OIDC for npm provenance
jobs:
release:
runs-on: ubuntu-latest
env:
NPM_CONFIG_PROVENANCE: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
- uses: elastic/oblt-actions/git/setup@v1
with:
github-token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
- run: npm ci # runs npm prepublish
- name: configure NPMJS token
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- run: npx semantic-release --dry-run="${DRY_RUN}"
env:
DRY_RUN: ${{ github.event.inputs.dry-run }}
GITHUB_TOKEN: ${{ secrets.RELEASE_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 add "${NPM_PACKAGE}@${VERSION}" stack_release
- if: ${{ always() && github.event.inputs.dry-run == 'false' }}
uses: elastic/oblt-actions/slack/notify-result@v1
with:
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel-id: "#synthetics-user_experience-uptime"