-
Notifications
You must be signed in to change notification settings - Fork 3
184 lines (152 loc) · 4.75 KB
/
publish.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Publish
on:
workflow_dispatch: {}
jobs:
docker:
name: Build & Publish Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build:docker
- name: Build image
run: docker build -t localsandbox/localsandbox .
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish image
run: docker push localsandbox/localsandbox:latest
- name: Publish image with tag
run: |
docker tag localsandbox/localsandbox localsandbox/localsandbox:${{ steps.tag.outputs.tag }}
docker push localsandbox/localsandbox:${{ steps.tag.outputs.tag }}
bundle-cli:
name: Build & Bundle CLI
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
osname: linux
arch: x64
- os: windows-latest
osname: win
arch: x64
- os: macos-latest
osname: macos
arch: arm64
- os: macos-13
osname: macos
arch: x64
runs-on: ${{ matrix.os }}
env:
BUNDLE_FILENAME: localsandbox-${{ matrix.osname }}-${{ matrix.arch }}.tar.gz
PKG_TARGET: ${{ matrix.osname }}-${{ matrix.arch }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Bundle CLI
run: npm run bundle:cli
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: localsandbox-${{ matrix.osname }}-${{ matrix.arch }}.tar.gz
path: ${{ env.BUNDLE_FILENAME }}
smoke-test-cli:
name: Smoke Test CLI
needs: bundle-cli
if: false
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
osname: linux
arch: x64
- os: windows-latest
osname: win
arch: x64
- os: macos-latest
osname: macos
arch: arm64
- os: macos-13
osname: macos
arch: x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Homebrew
if: matrix.osname == 'macos'
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: localsandbox-${{ matrix.osname }}-${{ matrix.arch }}.tar.gz
path: ./
- name: Extract artifact
run: tar -xzf localsandbox-${{ matrix.osname }}-${{ matrix.arch }}.tar.gz
- name: Smoke test localsandbox
run: ./localsandbox${{ (matrix.osname == 'win' && '.exe') || '' }} --version
- name: Install az cli (macos)
if: matrix.osname == 'macos'
run: brew update && brew install azure-cli
- name: Install az cli (linux)
if: matrix.osname == 'linux'
run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Install az cli (windows)
if: matrix.osname == 'win'
shell: powershell
run: $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://aka.ms/installazurecliwindowsx64 -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; Remove-Item .\AzureCLI.msi
- name: Test az cli
run: az --version
- name: Smoke test azl
run: ./azl${{ (matrix.osname == 'win' && '.exe') || '' }} --version
create-release:
name: Create GitHub Release
needs: [bundle-cli]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
path: ./
- name: List files
run: ls -la
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: "**/*.tar.gz"