Deploy to GitHub Pages #730
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 GitHub Pages | |
on: | |
#checkov:skip=CKV_GHA_7 | |
workflow_dispatch: | |
inputs: | |
test: | |
type: boolean | |
default: true | |
description: Whether its a test deploy | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: 0 0 * * * | |
permissions: {} | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
packages: read | |
statuses: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: EGO-Tech/starbase-ships | |
path: starbase-ships | |
- uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Persist npm cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} | |
- name: Persist Eleventy .cache | |
uses: actions/cache@v3 | |
with: | |
path: ./.cache | |
key: ${{ runner.os }}-eleventy-fetch-cache | |
- run: npm install | |
- name: Build Website | |
run: npm run build-ghpages | |
env: | |
repo__token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
if: github.ref == 'refs/heads/main' && github.event.inputs.test != 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_site |