-
Notifications
You must be signed in to change notification settings - Fork 101
92 lines (80 loc) · 2.68 KB
/
deploy-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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Publish Next Release (Manual)
on:
workflow_dispatch:
inputs:
ref:
description: Reference git commit to release (e.g. "master", "12341fa")
required: true
default: master
env:
NODE_VERSION: 18
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: AWS, credentials setup
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-1
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Add INPUT_SHA env var
run: |
export INPUT_SHA=$(git rev-parse ${{ github.event.inputs.ref }})
echo "INPUT_SHA=`echo $INPUT_SHA`" >> $GITHUB_ENV
- name: Install branch-github-actions
uses: actions/checkout@v4
with:
repository: BranchMetrics/branch-github-actions
ref: master
path: .branch-github-actions
token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }}
- name: Get next release version
uses: actions/github-script@v7
id: next-version
with:
result-encoding: string
script: |
const getNextVersion = require('./.branch-github-actions/custom-scripts/next-version');
const nextVersion = await getNextVersion({
core,
github,
context,
sha: process.env.INPUT_SHA,
});
return nextVersion;
env:
INPUT_SHA: ${{ env.INPUT_SHA }}
- name: Install Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Write version to files
run: |
./deployment/write-versions.sh ${{ steps.next-version.outputs.result }}
- name: Configure NPM
run: npm ci
- name: Release to npm, s3, prod
run: |
./deployment/release.sh ${{ steps.next-version.outputs.result }}
- name: Create Github Release
uses: actions/github-script@v7
env:
GE_NEXT_VERSION: ${{ steps.next-version.outputs.result }}
INPUT_SHA: ${{ env.INPUT_SHA }}
with:
result-encoding: string
script: |
const createRelease = require('./.branch-github-actions/custom-scripts/create-release');
const sha = process.env.INPUT_SHA;
const version = process.env.GE_NEXT_VERSION;
await createRelease({
core,
context,
github,
sha,
version,
});