Deploy to Prod (https://code-star.github.io/) #229
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: Deploy to Prod (https://code-star.github.io/) | |
on: | |
schedule: # Run workflow automatically | |
- cron: '0 1 * * *' # Runs every day at 1:00 AM (min hour day month) | |
push: | |
branches: | |
- production | |
workflow_dispatch: # Run workflow manually (without waiting for the cron to be called), through the Github Actions Workflow page directly | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install and Build components 🔧 | |
# .nojekyll: do not ignore _ dirs | |
run: | | |
touch .env | |
echo TWITTER_ACCESS_TOKEN=${{ secrets.TWITTER_ACCESS_TOKEN }} >> .env | |
echo TWITTER_USER_NAME=${{ secrets.TWITTER_USER_NAME }} >> .env | |
echo YOUTUBE_API_KEY=${{ secrets.YOUTUBE_API_KEY }} >> .env | |
echo YOUTUBE_PLAYLIST_ID=${{ secrets.YOUTUBE_PLAYLIST_ID }} >> .env | |
echo MASTODON_ACCESS_TOKEN=${{ secrets.MASTODON_ACCESS_TOKEN }} >> .env | |
echo MASTODON_ID=${{ secrets.MASTODON_ID }} >> .env | |
npm ci | |
npx next build && npx next export | |
touch out/.nojekyll | |
# CI: false # true -> fails on warning | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.ACCESS_TOKEN }} # Access token from the Prod repo, set in Settings > Secrets | |
repository-name: code-star/code-star.github.io | |
branch: main # The branch the action should deploy to. | |
folder: out # The folder the action should deploy. | |
clean: true # Automatically remove deleted files from the deploy branch |