Fix action monthly build

pull/1/head 20200812
Dreamacro 2020-08-12 10:56:30 +08:00
parent 72751ea0d8
commit dae4f35c40
2 changed files with 28 additions and 25 deletions

View File

@ -1,23 +0,0 @@
name: bash
on: [push]
jobs:
build:
name: Pull and Release
runs-on: ubuntu-latest
steps:
- name: Download file
env:
LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: |
wget -O ./GeoLite2-Country.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${LICENSE_KEY}&suffix=tar.gz"
tar zxvf ./GeoLite2-Country.tar.gz -C .
mv ./GeoLite2-Country_*/GeoLite2-Country.mmdb ./Country.mmdb
- name: Upload Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: Country.mmdb

View File

@ -1,6 +1,7 @@
name: Monthly Build
on:
workflow_dispatch:
schedule:
- cron: 0 0 12 * *
@ -13,11 +14,36 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: git tag
uses: actions/github-script@v2
id: tag
with:
script: |
const now = new Date()
return `${now.getFullYear()}${(now.getMonth() + 1).toString().padStart(2, '0')}${now.getDate().toString().padStart(2, '0')}`
result-encoding: string
- name: Push Tag
run: |
git config --global user.name 'Dreamacro'
git config --global user.email 'dreamacro@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git tag $(date +%Y%m%d)
git push origin $(date +%Y%m%d)
git tag ${{steps.tag.outputs.result}}
git push origin ${{steps.tag.outputs.result}}
- name: Download file
env:
LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: |
wget -O ./GeoLite2-Country.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${LICENSE_KEY}&suffix=tar.gz"
tar zxvf ./GeoLite2-Country.tar.gz -C .
mv ./GeoLite2-Country_*/GeoLite2-Country.mmdb ./Country.mmdb
- name: Upload Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: Country.mmdb
tag_name: ${{steps.tag.outputs.result}}