Skip to content

Cron Release

Cron Release #55

Workflow file for this run

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