-
Notifications
You must be signed in to change notification settings - Fork 4
108 lines (92 loc) · 3.03 KB
/
cli-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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: CLI Release
on:
workflow_dispatch:
inputs:
draft-release:
description: 'Draft release?'
required: false
type: boolean
default: true
prerelease:
description: 'Prerelease?'
required: false
type: boolean
default: true
npm-version:
description: 'NPM version bump?'
required: false
type: choice
options:
- major
- minor
- patch
default: 'patch'
# schedule:
# - cron: '0 12 * * 2' # Runs every Tuesday at 12:00 PM (noon) ET
permissions:
contents: write
jobs:
cli-release:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.AUTOMATION_USER_TOKEN }}
- name: Set Git author
run: |
git config --global user.email "[email protected]"
git config --global user.name "DevCycle Automation"
- name: Get node version
id: get_node_version
run: |
echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- run: corepack enable
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "${{ steps.get_node_version.outputs.NVMRC }}"
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build
- name: Bump CLI version
run: npm version ${{ inputs.npm-version }} --force
- name: Get latest tag
run: echo "LATEST_TAG=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
- name: Commit and push tag to main branch
run: |
git add .
git commit --amend -m "Release $LATEST_TAG"
git tag -f $LATEST_TAG
git push --atomic origin main $LATEST_TAG
- name: Release
uses: ./.github/actions/release
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# cannot read $LATEST_TAG here so using ${{ env.LATEST_TAG }}
release-tag: ${{ env.LATEST_TAG }}
draft: ${{ inputs.draft-release }}
prerelease: ${{ inputs.prerelease }}
node-auth-token: ${{ secrets.CLI_NPMJS_TOKEN }}
- name: Update Doc
uses: ./.github/actions/update-doc
with:
latest_tag: $LATEST_TAG
access_token: ${{ secrets.AUTOMATION_USER_TOKEN }}
- name: Update VSCode Extension
if: inputs.npm-version == 'minor' || inputs.npm-version == 'patch'
uses: ./.github/actions/update-vscode-extension
with:
latest_tag: $LATEST_TAG
access_token: ${{ secrets.AUTOMATION_USER_TOKEN }}
# Move this to release action yml once it works the first time
- name: Update Homebrew Formula
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.AUTOMATION_USER_TOKEN }}
repository: DevCycleHQ/homebrew-cli
event-type: start-deploy