-
Notifications
You must be signed in to change notification settings - Fork 41
72 lines (61 loc) · 2.21 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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:
- name: Get token
id: get_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
with:
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
permissions: >-
{
"contents": "write",
"pull_requests": "read"
}
repositories: >-
["synthetics"]
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.get_token.outputs.token }}
- uses: elastic/oblt-actions/git/setup@v1
with:
github-token: ${{ steps.get_token.outputs.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: ${{ steps.get_token.outputs.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"