-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (132 loc) · 5.16 KB
/
deploy.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
name: Deploy
on:
push:
tags:
- 'v*.*.*'
jobs:
build-ubuntu-macos:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.*'
- name: Build for ${{ matrix.os }}
run: |
mkdir -p artifacts/${{ matrix.os }}
if [ ${{ matrix.os }} = 'ubuntu-latest' ]; then
GOOS=linux GOARCH=amd64 go build -o artifacts/${{ matrix.os }}/addframe-linux
elif [ ${{ matrix.os }} = 'macos-latest' ]; then
GOOS=darwin GOARCH=amd64 go build -o artifacts/${{ matrix.os }}/addframe_amd64
GOOS=darwin GOARCH=arm64 go build -o artifacts/${{ matrix.os }}/addframe_arm64
lipo -create -output artifacts/${{ matrix.os }}/addframe-macos artifacts/${{ matrix.os }}/addframe_amd64 artifacts/${{ matrix.os }}/addframe_arm64
rm artifacts/${{ matrix.os }}/addframe_amd64 artifacts/${{ matrix.os }}/addframe_arm64
fi
shell: bash
- name: Copy addframe.json
run: |
cp addframe.json artifacts/${{ matrix.os }}/
cp south.json artifacts/${{ matrix.os }}/
cp southeast.json artifacts/${{ matrix.os }}/
cp southwest.json artifacts/${{ matrix.os }}/
shell: bash
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}
path: artifacts/${{ matrix.os }}
build-windows:
runs-on: windows-latest
needs: build-ubuntu-macos
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.*'
- name: Build for Windows
run: |
mkdir -p artifacts/windows-latest
go build -o artifacts/windows-latest/addframe.exe
shell: pwsh
- name: Copy addframe.json
run: |
Copy-Item -Path addframe.json -Destination artifacts/windows-latest/
Copy-Item -Path south.json -Destination artifacts/windows-latest/
Copy-Item -Path southeast.json -Destination artifacts/windows-latest/
Copy-Item -Path southwest.json -Destination artifacts/windows-latest/
shell: pwsh
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-windows-latest
path: artifacts/windows-latest
zip:
needs: [build-ubuntu-macos, build-windows]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: List artifacts directory
run: |
echo "Listing artifacts directory:"
ls -la ./artifacts || echo "artifacts directory not found"
echo "Listing zipped artifacts directory:"
ls -la ./artifacts/zipped-artifacts/ || echo "zipped-artifacts directory not found"
shell: bash
- name: Create ZIP files
run: |
mkdir -p artifacts/zipped-artifacts
cd artifacts
# List files to confirm existence
echo "Listing files in build-ubuntu-latest/"
ls -la build-ubuntu-latest
echo "Listing files in build-macos-latest/"
ls -la build-macos-latest
echo "Listing files in build-windows-latest/"
ls -la build-windows-latest
# Create ZIP files
zip -r zipped-artifacts/addframe-linux.zip build-ubuntu-latest/addframe-linux build-ubuntu-latest/addframe.json build-ubuntu-latest/south.json build-ubuntu-latest/southeast.json build-ubuntu-latest/southwest.json
zip -r zipped-artifacts/addframe-macos.zip build-macos-latest/addframe-macos build-macos-latest/addframe.json build-macos-latest/south.json build-macos-latest/southeast.json build-macos-latest/southwest.json
zip -r zipped-artifacts/addframe-windows.zip build-windows-latest/addframe.exe build-windows-latest/addframe.json build-windows-latest/south.json build-windows-latest/southeast.json build-windows-latest/southwest.json
# Verify ZIP files creation
echo "Listing ZIP files"
ls -la zipped-artifacts/
shell: bash
- name: Upload ZIP files
uses: actions/upload-artifact@v4
with:
name: zipped-artifacts
path: artifacts/zipped-artifacts/
if-no-files-found: error
retention-days: 90
compression-level: 6
overwrite: true
release:
needs: zip
runs-on: ubuntu-latest
steps:
- name: Download ZIP files
uses: actions/download-artifact@v4
with:
name: zipped-artifacts
path: ./artifacts
- name: Display structure of downloaded files
run: ls -R
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./artifacts/addframe-linux.zip
./artifacts/addframe-macos.zip
./artifacts/addframe-windows.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}