ci: add docker #343
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: Fetch Lyrics | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
inputs: | |
retry_failed_lyrics: | |
description: 'retry_failed_lyrics' | |
type: boolean | |
required: false | |
default: false | |
max_count: | |
description: 'max_count' | |
type: string | |
required: false | |
default: '2000' | |
lyrics: | |
description: 'lyrics' | |
type: string | |
required: false | |
default: '' | |
repository_dispatch: | |
types: [fetch_lyrics] | |
jobs: | |
Fetch_Lyrics: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: lyrics | |
- name: Checkout submodules to latest | |
run: git submodule update --init --recursive && git submodule update --recursive --remote | |
- name: Checkout appsettings.json from HEAD | |
run: 'git checkout HEAD appsettings.json' | |
- name: Execute Lyrics (workflow_dispatch) | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
env: | |
RETRY_FAILED_LYRICS: ${{ github.event.inputs.retry_failed_lyrics }} | |
MAX_COUNT: ${{ github.event.inputs.max_count }} | |
LYRICS: ${{ github.event.inputs.lyrics }} | |
run: 'chmod -R a+w Lyrics && docker run -v .:/output -v $PWD/appsettings.json:/app/appsettings.json ghcr.io/youtubeclipplaylist/lyrics' | |
- name: Execute Lyrics (repository_dispatch) | |
if: ${{ github.event_name == 'repository_dispatch' }} | |
env: | |
RETRY_FAILED_LYRICS: ${{ github.event.client_payload.retry_failed_lyrics }} | |
MAX_COUNT: ${{ github.event.client_payload.max_count }} | |
LYRICS: ${{ github.event.client_payload.lyrics }} | |
run: 'chmod -R a+w Lyrics && docker run -v .:/output -v $PWD/appsettings.json:/app/appsettings.json ghcr.io/youtubeclipplaylist/lyrics' | |
- name: Execute Lyrics (schedule, push) | |
if: ${{ github.event_name == 'schedule' || github.event_name == 'push' }} | |
run: 'chmod -R a+w Lyrics && docker run -v .:/output -v $PWD/appsettings.json:/app/appsettings.json ghcr.io/youtubeclipplaylist/lyrics' | |
- name: Git Auto Commit | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: lyrics | |
file_pattern: Lyrics Lyrics.json | |
skip_checkout: true | |
commit_message: 'Github Action: Fetch Lyrics' | |
commit_user_name: Github Action Bot # defaults to "GitHub Actions" | |
commit_author: Github Action Bot <[email protected]> # defaults to author of the commit that triggered the run |