-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (65 loc) · 2.03 KB
/
job.release.yaml
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
name: Release
on:
workflow_call:
inputs:
release_type:
required: false
default: ci
type: string
secrets:
RELEASE_TOKEN:
required: true
jobs:
release:
name: Create
runs-on: ubuntu-latest
steps:
- name: Obtain GitHub App Installation Access Token
id: get_token
run: |
TOKEN="$(npx obtain-github-app-installation-access-token ci ${{ secrets.RELEASE_TOKEN }})"
echo "::add-mask::$TOKEN"
echo "release_token=$TOKEN" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ env.release_token }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
cache-dependency-path: '**/package-lock.json'
- name: Install
run: npm ci
- name: Switch to next-release branch
run: |
git checkout -b release/next
- name: Set next version
run: |
npm run release:${{ inputs.release_type }}-prepare
echo "Next version: $(cat next-version.txt)"
echo "release_version=$(cat next-version.txt)" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ env.release_token }}
- name: Configure git user
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
- name: Switch to release branch
run: |
git checkout -b release/v${{ env.release_version }}
- name: Release
run: npm run release:${{ inputs.release_type }}
env:
GITHUB_TOKEN: ${{ env.release_token }}
- name: Create PR
id: release-pr
uses: thomaseizinger/create-pull-request@1.3.0
with:
title: Release v${{ env.release_version }}
body: PR Release ${{ env.release_version }}
head: release/v${{ env.release_version }}
base: main
GITHUB_TOKEN: ${{ env.release_token }}