Deploy #219
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 | |
on: | |
push: | |
branches: main | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
${{ github.workspace }}/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
- name: Generate Schedule Json | |
uses: CCIP-App/schedule-json-generator-action@v2 | |
with: | |
gcp-api-key: ${{ secrets.GCP_API_KEY }} | |
spreadsheet-key: "1oeoSMCZVewDOmTjbJ_Y_u3TEkwRp-IOckvu05hd6qJc" | |
default-avatar: "https://sitcon.org/2018/static/img/staffs/stone.png" | |
avatar-base-url: "https://sitcon.org/2018/static/img/speaker/" | |
output-path: ./public/schedule.json | |
- name: Install npm packages | |
run: npm install | |
- name: Build Pages | |
run: npm run build | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist | |
- name: Trigger workflow in other repo | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GHA_WORKFLOW_TRIGGER }} | |
script: | | |
const result = await github.rest.actions.createWorkflowDispatch({ | |
owner: 'sitcon-tw', | |
repo: 'camp', | |
workflow_id: 'updateSubmodules.yml', | |
ref: 'gh-pages' | |
}) | |
console.log(result) |