-
Notifications
You must be signed in to change notification settings - Fork 9
139 lines (123 loc) · 4.36 KB
/
release.yaml
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
name: Synchronization GEO Asset
on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- "**/README.md"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get latest go version
id: version
run: |
echo ::set-output name=go_version::$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g')
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.version.outputs.go_version }}
- name: Build geosite
id: build_site
run: |
cd sing-geosite
go run -v .
sha256sum geosite.db > geosite.db.sha256sum
- name: Build geoip
id: build_ip
run: |
cd sing-geoip
go run -v .
sha256sum geoip.db > geoip.db.sha256sum
- name: Release rule sets geosite
run: |
chmod +x .github/release-rule-set-geosite.sh
bash .github/release-rule-set-geosite.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release rule sets geoip
run: |
chmod +x .github/release-rule-set-geoip.sh
bash .github/release-rule-set-geoip.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set timezone to WIB Jakarta
uses: szenius/[email protected]
with:
timezoneLinux: "Asia/Jakarta"
timezoneMacos: "Asia/Jakarta"
timezoneWindows: "Indonesia Standard Time"
- name: Get current time
id: time
run: echo "::set-output name=time::$(date +'%Y%m%d%H%M%S')"
- name: Create a release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.time.outputs.time }}
release_name: ${{ steps.time.outputs.time }}
draft: false
prerelease: false
- name: Release geosite.db
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sing-geosite/geosite.db
asset_name: geosite.db
asset_content_type: application/octet-stream
- name: Release geosite.db.sha256sum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sing-geosite/geosite.db.sha256sum
asset_name: geosite.db.sha256sum
asset_content_type: application/octet-stream
- name: Release geoip.db
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sing-geoip/geoip.db
asset_name: geoip.db
asset_content_type: application/octet-stream
- name: Release geoip.db.sha256sum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sing-geoip/geoip.db.sha256sum
asset_name: geoip.db.sha256sum
asset_content_type: application/octet-stream
- name: Delete Old Release
uses: dev-drprasad/[email protected]
with:
repo: malikshi/sing-box-geo
keep_latest: 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Purge rule-set-geosite jsdelivr CDN
run: |
cd sing-geosite/rule-set-geosite || exit 1
for file in $(ls); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@rule-set-geosite/${file}"
done
- name: Purge rule-set-geoip jsdelivr CDN
run: |
cd sing-geoip/rule-set-geoip || exit 1
for file in $(ls); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@rule-set-geoip/${file}"
done