main #171
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: main | |
on: | |
# run this workflow manually from the Actions tab | |
workflow_dispatch: | |
schedule: | |
- cron: "0 5 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
# for gcp and git-auto-commit-action | |
contents: write | |
id-token: write | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v2 | |
- name: Setup GCP | |
id: auth | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: "${{ secrets.GCP_CREDENTIALS }}" | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v2 | |
- name: Download sqlite | |
run: gcloud storage cp gs://hnhd/hackernews.sqlite ./data | |
- run: bun install | |
- run: bun run src/update.ts | |
- run: bun run src/output.ts | |
- name: Upload sqlite | |
run: gcloud storage cp ./data/hackernews.sqlite gs://hnhd/hackernews.sqlite | |
- name: Remove sqlite | |
run: rm ./data/hackernews.sqlite | |
- name: Commit if changed | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: updated with the latest headlines |