Export and deploy pages #2351
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: Export and deploy pages | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 0-9 * * *" | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
actions: write | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
# runs-on: self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Install Dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Run Export Scripts | |
run: npm run export | |
- name: List files | |
run: ls -alh | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ./public | |
# Discord webhook | |
- name: Generate a token | |
id: generate_token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Run Discord Script | |
run: npm run start:discord | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
DISCORD_LAST_ARTICLE_NO: ${{ vars.DISCORD_LAST_ARTICLE_NO }} | |
DISCORD_WEBHOOK_TEST: ${{ secrets.DISCORD_WEBHOOK_TEST }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
continue-on-error: true | |
# Deployment job | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |