Repository navigation
115 lines (97 loc) 路 3.88 KB
/
Copy pathgo.yml
File metadata and controls
115 lines (97 loc) 路 3.88 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
name: Build and Release
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [darwin, linux, windows]
arch: [amd64]
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build and Archive
run: |
mkdir -p GOWebServer
GOOS=${{ matrix.os }}
GOARCH=amd64
EXT=""
if [ "$GOOS" == "windows" ]; then
EXT=".exe"
fi
go clean
GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build -trimpath -o GOWebServer/GOWebServer$EXT
mkdir -p GOWebServer/cache
echo "YOUR CACHE FILE HERE" > GOWebServer/cache/YOUR_CACHE_FILE_HERE
mkdir -p GOWebServer/ssl
cp -r ssl/* GOWebServer/ssl/ 2>/dev/null || echo "No SSL files found"
cp README.md GOWebServer/ 2>/dev/null || echo "No README found"
mkdir -p GOWebServer/scripts
cp scripts/setup-ddos-protection.sh GOWebServer/scripts/ 2>/dev/null || echo "No script found"
os=${{ matrix.os }}
arch=${{ matrix.arch }}
zip -r GOWebServer-${os}-${arch}.zip GOWebServer
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: GOWebServer-${{ matrix.os }}-${{ matrix.arch }}
path: GOWebServer-${{ matrix.os }}-${{ matrix.arch }}.zip
outputs:
matrix: ${{ toJSON(matrix) }}
fetch_deps:
runs-on: ubuntu-latest
steps:
- name: Clone Dependencies Repo
run: |
git clone https://codeberg.org/Vo/GOWebServer-Depedencies.git deps
- name: Archive Dependencies
run: |
cd deps
zip -j GeoLite2-City.zip GeoLite2-City.mmdb
- name: Upload Dependency Artifact
uses: actions/upload-artifact@v4
with:
name: GeoLite2-City
path: deps/GeoLite2-City.zip
release:
needs: [build, fetch_deps]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Move Artifacts
run: |
for file in GOWebServer-*/*.zip; do
mv "$file" . || echo "Failed to move $file"
done
mv GeoLite2-City/*.zip . || echo "Failed to move dependency"
- name: Create Tag
id: create_tag
run: |
UNIQUE_CODE=$(openssl rand -hex 3)
TAG_NAME="releases-${UNIQUE_CODE}"
git tag $TAG_NAME
echo "tag_name=${UNIQUE_CODE}" >> $GITHUB_OUTPUT
shell: bash
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.create_tag.outputs.tag_name }}
name: releases-${{ steps.create_tag.outputs.tag_name }}
files: |
GOWebServer-darwin-amd64.zip
GOWebServer-linux-amd64.zip
GOWebServer-windows-amd64.zip
GeoLite2-City.zip
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}