-
Notifications
You must be signed in to change notification settings - Fork 36
59 lines (51 loc) · 1.68 KB
/
dist-tag.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
name: dist-tag
on:
workflow_dispatch:
inputs:
version:
type: string
description: Version to dist tag.
required: true
dist-tag:
type: string
description: Dist tag to use.
required: true
permissions:
contents: read
jobs:
dist-tag:
env:
VERSION: ${{ github.event.inputs.version }}
DIST_TAG: ${{ github.event.inputs.dist-tag }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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 }}
- 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 }}
- name: Validate version input is a valid semver
run: |
if ! [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-z0-9.]+)?(\+[a-z0-9.]+)?$ ]]; then
echo "Version input '${VERSION}' is not a valid semver"
exit 1
fi
- name: Validate dist-tag input is a valid dist-tag
run: |
case "$DIST_TAG" in
alpha|beta|latest|stack_release)
exit 0 ;;
*)
echo "Dist tag input '${DIST_TAG}' is not a valid dist-tag"
exit 1 ;;
esac
- name: NPM dist-tag
run: |
npm dist-tag --otp=${TOTP_CODE} add "@elastic/synthetics@${VERSION}" "${DIST_TAG}"