add github action cron-release.yml
This commit is contained in:
parent
70fdcd08ae
commit
5e7037e334
|
@ -0,0 +1,66 @@
|
|||
name: Cron Release
|
||||
|
||||
on:
|
||||
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 "::set-env name=RELEASE_NAME::Released on $(date +%Y%m%d)"
|
||||
echo "::set-env name=TAG_NAME::$(date +%Y%m%d)"
|
||||
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/china_ip_list.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.PERSONAL_TOKEN }}@github.com/${{ github.repository }}"
|
||||
git push -f -u origin release
|
Loading…
Reference in New Issue