Skip to content

API | IMDb | Update #128

API | IMDb | Update

API | IMDb | Update #128

name: API | IMDb | Update
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs every day at midnight
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
jobs:
deploy:
name: Process
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src/imdb
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun i
- name: Build API
run: bun run build:api
- name: Set current date as env variable
run: echo "TODAY_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Setup Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Commit and push tmp directory
working-directory: ./
run: |
git checkout --orphan get
git reset --hard
git pull origin get
git rm -rf imdb || true
cp -r tmp/imdb .
git add imdb
git commit -m ":rocket: IMDb | ${{ env.TODAY_DATE }} | Update" || true
git push origin get
env:
github_TOKEN: ${{ secrets.GITHUB_TOKEN }}