-
Notifications
You must be signed in to change notification settings - Fork 267
68 lines (58 loc) · 1.93 KB
/
cron-release.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
name: Cron Release
on:
# push:
# branches: [ master ]
schedule:
- cron: 0 0 20 * *
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Create dist folder
run: mkdir -p dist
- name: buildAction
run: ./build.sh
- name: Get china_ip_list.txt
run: curl -LR -o dist/china_ip_list.txt "https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt"
- name: Transform china_ip_list to MaxMind mmdb
run: |
cd dist
./ipip2mmdb -s ./china_ip_list.txt -d Country.mmdb
- name: Set env variables
run: |
echo "RELEASE_NAME=$(date +%Y%m%d)" >> $GITHUB_ENV
echo "TAG_NAME=$(date +%Y%m%d)" >> $GITHUB_ENV
shell: bash
- name: Generate version file
run: |
cd dist
echo $TAG_NAME > version
- name: Push to release branch
run: |
mkdir publish
cp -af dist/version publish/version
cp -af dist/Country.mmdb publish/Country.mmdb
cd publish
git init
git config --local user.name "${{ github.actor }}"
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git checkout -b release
git add .
git commit -m "${{ env.RELEASE_NAME }}"
git remote add origin "https://${{ github.actor }}:${{ secrets.CRON_RELEASE_WORKFLOW }}@github.com/${{ github.repository }}"
git push -f -u origin release