Skip to content

release_event

release_event #329

Workflow file for this run

on:
workflow_dispatch:
repository_dispatch:
types: [release_event]
name: Match Data
concurrency:
group: match-data
cancel-in-progress: false
jobs:
check_already_run:
name: Check if release already created today
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check.outputs.should_run }}
steps:
- name: Check for release today
id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
TODAY=$(TZ=Europe/London date +'%Y%m%d')
# Get the latest release tag
LATEST_TAG=$(gh api \
-H "Accept: application/vnd.github+json" \
"/repos/${{ github.repository }}/releases/latest" \
--jq '.tag_name' 2>/dev/null || echo "")
# Tags are formatted as YYYYMMDD.HHMMSS, so check if it starts with today's date
if [[ "$LATEST_TAG" == ${TODAY}.* ]]; then
echo "Release already created today (tag: $LATEST_TAG). Skipping."
echo "should_run=false" >> $GITHUB_OUTPUT
else
echo "No release today (latest: $LATEST_TAG). Proceeding."
echo "should_run=true" >> $GITHUB_OUTPUT
fi
match_with_imdb:
name: Match with IMDB
needs: check_already_run
if: needs.check_already_run.outputs.should_run == 'true'
runs-on: ubuntu-latest
env:
MOVIEDB_API_KEY: ${{ secrets.MOVIEDB_API_KEY }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
- run: npm install
- name: Download cached data
uses: clusterflick/release-downloader@v2
with:
token: ${{ secrets.PAT }}
repository: "clusterflick/data-cached"
latest: true
fileName: "*"
out-file-path: "cached-data"
- name: Download combined data
uses: clusterflick/release-downloader@v2
with:
token: ${{ secrets.PAT }}
repository: "clusterflick/data-combined"
latest: true
fileName: "*"
out-file-path: "combined-data"
- name: Match Data
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
retry_wait_seconds: 30
max_attempts: 10
command: npx scripts match imdb
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: match_with_imdb
path: matched-data/
match_with_letterboxd:
name: Match with Letterboxd
needs: check_already_run
if: needs.check_already_run.outputs.should_run == 'true'
runs-on: self-hosted
env:
MOVIEDB_API_KEY: ${{ secrets.MOVIEDB_API_KEY }}
steps:
- uses: actions/checkout@v6
- name: Set Playwright path
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-browsers" >> $GITHUB_ENV
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
- run: npm install
- run: npx playwright install --with-deps
- name: Download cached data
uses: clusterflick/release-downloader@v2
with:
token: ${{ secrets.PAT }}
repository: "clusterflick/data-cached"
latest: true
fileName: "*"
out-file-path: "cached-data"
- name: Download combined data
uses: clusterflick/release-downloader@v2
with:
token: ${{ secrets.PAT }}
repository: "clusterflick/data-combined"
latest: true
fileName: "*"
out-file-path: "combined-data"
- name: Match Data
uses: nick-fields/retry@v3
with:
timeout_minutes: 180
retry_wait_seconds: 30
max_attempts: 10
command: npx scripts match letterboxd
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: match_with_letterboxd
path: matched-data/
- name: Save test failure artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: retrieve_sources-playwright-failures
path: ./playwright-failures
match_with_metacritic:
name: Match with Metacritic
needs: check_already_run
if: needs.check_already_run.outputs.should_run == 'true'
runs-on: ubuntu-latest
env:
MOVIEDB_API_KEY: ${{ secrets.MOVIEDB_API_KEY }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
- run: npm install
- name: Download cached data
uses: clusterflick/release-downloader@v2
with:
token: ${{ secrets.PAT }}
repository: "clusterflick/data-cached"
latest: true
fileName: "*"
out-file-path: "cached-data"
- name: Download combined data
uses: clusterflick/release-downloader@v2
with:
token: ${{ secrets.PAT }}
repository: "clusterflick/data-combined"
latest: true
fileName: "*"
out-file-path: "combined-data"
- name: Match Data
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
retry_wait_seconds: 30
max_attempts: 10
command: npx scripts match metacritic
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: match_with_metacritic
path: matched-data/
match_with_rotten_tomatoes:
name: Match with Rotten Tomatoes
needs: check_already_run
if: needs.check_already_run.outputs.should_run == 'true'
runs-on: ubuntu-latest
env:
MOVIEDB_API_KEY: ${{ secrets.MOVIEDB_API_KEY }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
- run: npm install
- name: Download cached data
uses: clusterflick/release-downloader@v2
with:
token: ${{ secrets.PAT }}
repository: "clusterflick/data-cached"
latest: true
fileName: "*"
out-file-path: "cached-data"
- name: Download combined data
uses: clusterflick/release-downloader@v2
with:
token: ${{ secrets.PAT }}
repository: "clusterflick/data-combined"
latest: true
fileName: "*"
out-file-path: "combined-data"
- name: Match Data
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
retry_wait_seconds: 30
max_attempts: 10
command: npx scripts match rottentomatoes
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: match_with_rotten_tomatoes
path: matched-data/
create_release:
name: Create Release
runs-on: ubuntu-latest
needs:
[
check_already_run,
match_with_imdb,
match_with_letterboxd,
match_with_metacritic,
match_with_rotten_tomatoes,
]
if: needs.check_already_run.outputs.should_run == 'true'
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v7
with:
pattern: match_with_*
path: matched-data/
merge-multiple: true
- name: Generate Tag
run: echo "TAG=$(TZ=Europe/London date +'%Y%m%d.%H%M%S')" >> $GITHUB_ENV
- uses: ncipollo/release-action@v1
id: release
with:
allowUpdates: false
artifactErrorsFailBuild: true
artifacts: "matched-data/*"
makeLatest: true
tag: ${{ env.TAG }}
commit: main
body: |
Created by job ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Output summary
run: |
echo "🔖 New release - ${{ steps.release.outputs.html_url }}" >> $GITHUB_STEP_SUMMARY
trigger_downstream:
name: Trigger downstream
runs-on: ubuntu-latest
needs: [create_release]
# Only run if a new release was created (not when skipped due to existing release)
if: success()
steps:
- name: Repository Dispatch for clusterflick.com
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT }}
repository: clusterflick/clusterflick.com
event-type: release_event