pre-release #7
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
--- | |
# When triggered it will prepare the release by creating a Pull Request with the | |
# changes to be merged. Then it will be possible to run the release manually | |
name: pre-release | |
on: | |
workflow_dispatch: | |
inputs: | |
dry-run: | |
type: boolean | |
description: 'Run release process in dry-run mode' | |
default: true | |
permissions: | |
contents: read | |
env: | |
SLACK_BUILD_MESSAGE: "Build: (<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>)" | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
# Needed to write the release changelog | |
contents: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ env.GITHUB_TOKEN }} | |
- uses: elastic/oblt-actions/git/setup@v1 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Install dependencies | |
run: npm ci | |
# This prevent lerna command from throwing this error: | |
# "Working tree has uncommitted changes, please commit or remove the following changes before continuing" | |
- name: Ignore git uncommitted changes | |
run: git update-index --skip-worktree .npmrc | |
- name: Create PR with the required changes to be released | |
id: pre-release | |
env: | |
DRY_RUN: "${{ inputs.dry-run }}" | |
run: | | |
npm run ci:pre-release | |
if [ -e .pr.txt ] ; then | |
echo "pr=$(cat .pr.txt)" >> "$GITHUB_OUTPUT" | |
rm .pr.txt | |
fi | |
- if: ${{ success() && inputs.dry-run == false }} | |
uses: elastic/oblt-actions/slack/send@v1 | |
with: | |
bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | |
channel-id: "#apm-agent-js" | |
message: | | |
:runner: [${{ github.repository }}] Pre Release has been triggered. Review the PR ${{ steps.pre-release.outputs.pr }}. ${{ env.SLACK_BUILD_MESSAGE }} | |
- if: ${{ failure() && inputs.dry-run == false }} | |
uses: elastic/oblt-actions/slack/send@v1 | |
with: | |
bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | |
channel-id: "#apm-agent-js" | |
message: | | |
:ghost: [${{ github.repository }}] Pre Release failed. ${{ env.SLACK_BUILD_MESSAGE }} |