Auto-generate scripts #121
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto-generate scripts | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- "generate/**" | |
- ".github/workflows/**" | |
schedule: | |
- cron: "0 9 * * FRI" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.17 | |
- name: "Run generator tests" | |
shell: bash | |
run: | | |
sudo bash ./test.sh 2>&1 | |
working-directory: generate | |
- name: "Run regeneration script" | |
shell: bash | |
run: | | |
sudo bash ./generate-all.sh 2>&1 | |
working-directory: generate | |
- name: Generate tag name | |
run: echo "TAG_NAME=$(date +%F-%H-%M)" >> $GITHUB_ENV | |
- name: Release scripts | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: block/*.user.js | |
name: Automatic script generation | |
tag_name: ${{ env.TAG_NAME }} | |
body: "This release contains all scripts provided by this repository.\n\nPlease see [the main project page](${{ github.server_url }}/${{ github.repository }}) for a description of the scripts." | |
body_path: generate/release/release.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Delete older releases | |
uses: dev-drprasad/[email protected] | |
with: | |
keep_latest: 2 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |