-
Notifications
You must be signed in to change notification settings - Fork 22
118 lines (104 loc) · 3.6 KB
/
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
109
110
111
112
113
114
115
116
117
118
name: Release
on:
push:
tags:
- v*
env:
HUGO_VERSION: 0.118.2
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Swap to main
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0 # Full fetch
- name: Get Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.CC_OSS_BOT_ID }}
application_private_key: ${{ secrets.CC_OSS_BOT_PEM }}
- name: Install hugo
uses: supplypike/setup-bin@v1
with:
uri: "https://github.com/gohugoio/hugo/releases/download/v${{env.HUGO_VERSION}}/hugo_extended_${{env.HUGO_VERSION}}_linux-amd64.tar.gz"
name: "hugo"
version: ${{env.HUGO_VERSION}}
- name: Enable Corepack before setting up Node
run: corepack enable
- name: Use Node.js 20.x
uses: actions/setup-node@v2
with:
node-version: 20.x
# TODO: Remove when possible (https://github.com/actions/setup-node/issues/515)
- name: Windows Node fix
if: ${{ matrix.os == 'windows-latest' }}
run: |
$WhereNode = Get-Command node | Select-Object -ExpandProperty Definition
$NodeDirPath = Split-Path $WhereNode -Parent
cd $NodeDirPath
npm install npm@10.7.0
- name: Use Ruby 2.7.x
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Use Go 1.21.x
uses: actions/setup-go@v2
with:
go-version: "^1.21.1"
- name: Yarn stuff
run: |
yarn install --immutable
working-directory: ./javascript-modules
- name: Get Version
run: echo GIT_VERSION="$(git describe --tags | sed 's/^v\(.*\)$/\1/')" >> $GITHUB_ENV
- name: Verify Changelog
run: |
node ./.backstage/changelog.cjs
- name: Ensure main / tag parity
run: |
[[ $(git tag --points-at HEAD) = "v$GIT_VERSION" ]] && echo "Main is at v$GIT_VERSION"
- name: Update versions
run: |
node ./.backstage/version.js $GIT_VERSION
- name: Vendor dependencies
run: |
node ./.backstage/vendor.js
- run: yarn install
working-directory: ./javascript-modules
- name: Run tests
run: |
node ./.backstage/test.js
- name: Run integration tests
run : |
yarn run itest-slow
working-directory: ./javascript-modules/integration-tests
- name: Publish
run: |
node ./.backstage/publish.js $GIT_VERSION seriously
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
- name: Build CHANGELOG
run: |
node ./.backstage/changelog.cjs write
if test -f "RELEASE.md"; then
echo HAS_RELEASE="true" >> $GITHUB_ENV
fi
- name: Update git
run: |
git config --global user.name "cloudcannon-oss[bot]"
git config --global user.email "115603236+cloudcannon-oss[bot]@users.noreply.github.com"
git add -A && git commit -m "build: releasing $GIT_VERSION"
git tag -a hugo/v$GIT_VERSION -m "build: releasing $GIT_VERSION"
git push && git push --tags
- name: Publish GitHub Release
uses: softprops/action-gh-release@v1
if: env.HAS_RELEASE == 'true'
with:
body_path: RELEASE.md
env:
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }}