Magic-Spoiler/.github/workflows/deploy.yml
dependabot[bot] 34068d4d5e
Some checks failed
Deploy / Check for new spoiler (push) Has been cancelled
Bump actions/upload-artifact from 4 to 5 (#312)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-22 10:24:50 +01:00

74 lines
2.0 KiB
YAML

name: Deploy
on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- '**.md'
schedule:
# Every 8 hours = 3 times a day
- cron: '0 */8 * * *'
jobs:
deploy:
# Do not run the scheduled workflow on forks
if: github.event_name != 'schedule' || github.repository_owner == 'Cockatrice'
name: Check for new spoiler
runs-on: ubuntu-latest
env:
DEPLOY: ${{github.ref == 'refs/heads/master'}}
OUTPUT_PATH: out
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Checkout output branch
# Run only when triggered from master
if: env.DEPLOY == 'true'
uses: actions/checkout@v5
with:
ref: files
path: ${{env.OUTPUT_PATH}}
- name: Install requirements using pip
shell: bash
run: python3 -m pip install --requirement requirements.txt
- name: Run script
id: run
shell: bash
run: python3 -m magic_spoiler
- name: Upload artifacts
# Run only when triggered from a PR
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v5
with:
name: spoiler-output
path: ${{github.workspace}}/${{env.OUTPUT_PATH}}
if-no-files-found: error
- name: Deploy changes
# Run only when triggered from master and changes are available
if: env.DEPLOY == 'true' && steps.run.outputs.deploy == 'true'
shell: bash
working-directory: ${{env.OUTPUT_PATH}}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add "*.xml" SpoilerSeasonEnabled
git commit -m "Deploy: $GITHUB_SHA"
git push
deploy_commit=`git rev-parse HEAD`
echo "::notice title=New data uploaded::See deployment: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$deploy_commit"