Refine workflow

pull/1/head
loyalsoldier 2020-11-01 11:14:02 +08:00
parent dae4f35c40
commit 9e459ff192
No known key found for this signature in database
GPG Key ID: 23829BBC1ACF2C90
1 changed files with 19 additions and 25 deletions

View File

@ -1,36 +1,19 @@
name: Monthly Build name: Weekly Build
on: on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: 0 0 12 * * - cron: 0 22 * * FRI
jobs: jobs:
build: build:
name: Pull and Release name: Pull and Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out repo - name: Set variables
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: | run: |
git config --global user.name 'Dreamacro' echo "tag=$(date +%Y%m%d)" >> $GITHUB_ENV
git config --global user.email 'dreamacro@users.noreply.github.com' shell: bash
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git tag ${{steps.tag.outputs.result}}
git push origin ${{steps.tag.outputs.result}}
- name: Download file - name: Download file
env: env:
@ -46,4 +29,15 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
files: Country.mmdb files: Country.mmdb
tag_name: ${{steps.tag.outputs.result}} tag_name: ${{ env.tag }}
- name: Git push assets to "release" branch
run: |
git init
git config --local user.name "actions"
git config --local user.email "action@github.com"
git checkout -b release
git add Country.mmdb
git commit -m "${{ env.tag }}"
git remote add publish https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git push -f publish release