-
Notifications
You must be signed in to change notification settings - Fork 1
179 lines (169 loc) · 4.77 KB
/
workflow.yml
File metadata and controls
179 lines (169 loc) · 4.77 KB
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
name: Build
on:
push:
branches:
- '2.0'
tags:
- '*'
pull_request:
env:
VERSION: dev
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: dist
jobs:
build-test:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ linux,darwin,windows ]
arch: [ amd64,arm64 ]
exclude:
- os: windows
arch: arm64
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v5
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: 1.25
- name: build
run: make
- name: test
if: ${{ matrix.os == 'linux' && matrix.arch == 'amd64' }}
run: make test
- name: package
run: make package
- name: Upload production artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.arch }}
path: dist
retention-days: 1
release-aws-20:
runs-on: ubuntu-latest
needs: [build-test]
if: startsWith(github.ref, 'refs/heads/')
strategy:
matrix:
os: [ linux,darwin,windows ]
arch: [ amd64,arm64 ]
exclude:
- os: windows
arch: arm64
steps:
- name: 'Download Artifact'
uses: actions/download-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.arch }}
path: dist
- name: release aws dev
if: startsWith(github.ref, 'refs/heads/')
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
DEST_DIR: wodby-cli/2.0/${{ matrix.os }}/${{ matrix.arch }}
release-aws-tagged:
runs-on: ubuntu-latest
needs: [build-test]
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os: [ linux,darwin,windows ]
arch: [ amd64,arm64 ]
exclude:
- os: windows
arch: arm64
steps:
- name: set version from tag
if: startsWith(github.ref, 'refs/tags/')
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: 'Download Artifact'
uses: actions/download-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.arch }}
path: dist
- name: release aws tagged
if: startsWith(github.ref, 'refs/tags/')
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
DEST_DIR: wodby-cli/$VERSION/${{ matrix.os }}/${{ matrix.arch }}
create-gh-release:
runs-on: ubuntu-latest
needs: [build-test]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: get the version from tag
id: version
if: startsWith(github.ref, 'refs/tags/')
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.VERSION }}
release_name: ${{ steps.version.outputs.VERSION }}
draft: true
prerelease: false
upload-gh-release-artifacts:
runs-on: ubuntu-latest
needs: [create-gh-release]
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os: [ linux,darwin,windows ]
arch: [ amd64,arm64 ]
exclude:
- os: windows
arch: arm64
steps:
- name: set version from tag
if: startsWith(github.ref, 'refs/tags/')
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: 'Download Artifact'
uses: actions/download-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.arch }}
path: dist
- name: release github
if: startsWith(github.ref, 'refs/tags/')
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: dist/wodby-*.tar.gz
overwrite: true
tags: true
draft: false
tag_name: ${{ env.VERSION }}
build-release-image:
runs-on: ubuntu-latest
needs: [build-test]
steps:
- uses: actions/checkout@v5
- uses: docker/setup-qemu-action@v4
with:
platforms: amd64,arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push 2.0 image
uses: docker/build-push-action@v2
with:
context: .
push: true
build-args: VERSION=2.0
platforms: linux/amd64,linux/arm64
tags: wodby/wodby-cli:2.0