-
Notifications
You must be signed in to change notification settings - Fork 48
100 lines (99 loc) · 3.36 KB
/
deployRelease.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Deploy Release
on:
workflow_dispatch:
inputs:
version:
description: "Version"
required: true
# Only allow one workflow instance for this branch to run at a time
concurrency: ${{ github.workflow }}-${{ github.ref }}
# This workflow is split into release and prerelease jobs so that the
# release job can require a manual approval. Otherwise, the release and
# prerelease jobs should be identical.
jobs:
validate:
name: "Validate"
runs-on: ubuntu-latest
steps:
- uses: adobe/project-card-release-automation/validate-version@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ github.event.inputs.version }}
release:
name: "Release"
runs-on: ubuntu-latest
needs: validate
# this environment requires manual approval
environment: Production
# final release versions do not contain '-'
if: ${{ contains(github.event.inputs.version, '-') == false }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: webfactory/[email protected]
with:
ssh-private-key: |
${{ secrets.ALLOY_BOT_GITHUB_SSH_PRIVATE_KEY }}
${{ secrets.CDN_PRIVATE_KEY }}
- uses: actions/cache@v4
id: npm-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}-${{ secrets.NPM_CACHE_VERSION }} # increment NPM_CACHE_VERSION secret to force cache reset
- name: Install dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci
- run: ./scripts/deploy.js ${{ github.event.inputs.version }} latest
env:
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: build
path: |
./dist/alloy.js
./dist/alloy.min.js
prerelease:
name: "Prerelease"
runs-on: ubuntu-latest
needs: validate
# prerelease versions contain '-'
if: ${{ contains(github.event.inputs.version, '-') }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: webfactory/[email protected]
with:
ssh-private-key: |
${{ secrets.ALLOY_BOT_GITHUB_SSH_PRIVATE_KEY }}
${{ secrets.CDN_PRIVATE_KEY }}
- uses: actions/cache@v2
id: npm-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}-${{ secrets.NPM_CACHE_VERSION }} # increment NPM_CACHE_VERSION secret to force cache reset
- name: Install dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci
- run: ./scripts/deploy.js ${{ github.event.inputs.version }} next
env:
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: build
path: |
./dist/alloy.js
./dist/alloy.min.js
record:
name: "Record Version"
runs-on: ubuntu-latest
needs: [prerelease, release]
if: failure() == false
steps:
- uses: adobe/project-card-release-automation/record-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ github.event.inputs.version }}