-
Notifications
You must be signed in to change notification settings - Fork 3
168 lines (142 loc) · 5.68 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#*********************************************************************
# Copyright (c) Intel Corporation 2023
# SPDX-License-Identifier: Apache-2.0
#*********************************************************************/
# This workflow will release new versions when required using semantic-release
name: Semantic-Release CI
on:
push:
branches: [beta]
permissions:
contents: read
jobs:
prepare:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout Console
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Check out Sample Web UI
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # master
with:
repository: open-amt-cloud-toolkit/sample-web-ui
ref: main
path: ./temp
- run: npm ci
working-directory: ./temp
- run: npm run build-enterprise
working-directory: ./temp
- name: move files
run: mv ./temp/ui/browser/* ./internal/controller/http/ui
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ">=1.23.0"
- name: 🔬 Check semantic versioning
id: semantic-release
env:
GITHUB_REF: ${{ github.head_ref }}
run: |
npx semantic-release --no-ci --dry-run --plugins @semantic-release/commit-analyzer --branches $GITHUB_REF
VERSION=$(cat .VERSION)
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
#build linux
- shell: bash
if: matrix.os == 'ubuntu-latest'
run: |
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=$VERSION'" -trimpath -o dist/linux/console_linux_x64 ./cmd/app/main.go
- shell: bash
if: matrix.os == 'windows-latest'
run: |
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=$VERSION'" -trimpath -o dist/windows/console_windows_x64 ./cmd/app/main.go
- shell: bash
if: matrix.os == 'macos-latest'
run: |
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=$VERSION'" -trimpath -o dist/farwin/console_mac_arm64 ./cmd/app/main.go
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
if: matrix.os == 'ubuntu-latest'
with:
path: dist/linux
key: linux-${{ env.sha_short }}
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
if: matrix.os == 'macos-latest'
with:
path: dist/darwin
key: darwin-${{ env.sha_short }}
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
if: matrix.os == 'windows-latest'
with:
path: dist/windows
key: windows-${{ env.sha_short }}
enableCrossOsArchive: true
release:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-latest
needs: prepare
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
# copy the caches from prepare
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: dist/linux
key: linux-${{ env.sha_short }}
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: dist/darwin
key: darwin-${{ env.sha_short }}
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: dist/windows
key: windows-${{ env.sha_short }}
enableCrossOsArchive: true
- name: Checkout Console
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Check out Sample Web UI
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # master
with:
repository: open-amt-cloud-toolkit/sample-web-ui
ref: main
path: ./temp
- run: npm ci
working-directory: ./temp
- run: npm run build-enterprise
working-directory: ./temp
- name: move files
run: mv ./temp/ui/* ./internal/controller/http/ui
- name: Docker Login
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: vprodemo.azurecr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
logout: true
- name: Semantic Release
uses: cycjimmy/semantic-release-action@b1b432f13acb7768e0c8efdec416d363a57546f2 # v4.1.1
if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit
with:
semantic_version:
19.0.5 # It is recommended to specify a version range
# for semantic-release when using
# semantic-release-action lower than @v3
extra_plugins: |
@semantic-release/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ROSIE_TOKEN }}