Skip to content

Add toggle for dark mode, using local storage #2127

Add toggle for dark mode, using local storage

Add toggle for dark mode, using local storage #2127

name: Gatsby Publish
on:
push:
branches:
[ main ]
pull_request:
types: [ opened, synchronize, reopened ]
schedule: ## Do a run three times daily, to refresh website content
- cron: '25 22,04,12 * * *'
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: uses-github-api # do not allow any concurrency or the different builds will fight for the github rate limit and all take far longer
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: "npm" # this only caches global dependencies
- run: npm ci --prefer-offline
- run: npm run test
env:
CI: true
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get current date
id: date
run: |
echo "month=$(date +'%Y-%m')" >> "$GITHUB_OUTPUT"
echo "day=$(date +'%d')" >> "$GITHUB_OUTPUT"
- name: Restoring cached GitHub API results
uses: actions/cache@v3
with:
path: |
.cache-github-api
key: gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: | # If there are multiple partial matches for a restore key, the action returns the most recently created cache.
gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}
gatsby-build-github-queries-
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: "npm" # this only caches global dependencies
- run: npm ci --prefer-offline
- run: npm run build -- ${{ github.ref_name == 'main' && '--prefix-paths' || '' }}
env:
NODE_ENV: production
GATSBY_ACTIVE_ENV: production
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TABLEAU_PERSONAL_ACCESS_TOKEN: ${{ secrets.TABLEAU_PERSONAL_ACCESS_TOKEN }}
TABLEAU_SITE: ${{ secrets.TABLEAU_SITE }}
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY }}
- name: Caching GitHub API results
uses: actions/cache/save@v3 # save the cache even if the integration tests fail
with:
path: |
.cache-github-api
key: gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: Raise defects if needed
uses: jbangdev/[email protected]
# Only try and raise defects on the main builds
if: "github.repository == 'quarkusio/extensions' && github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'schedule')"
with:
script: site-validation/bad-image-issue.java
scriptargs: token=${{ secrets.GITHUB_TOKEN }} issueRepo=${{ github.repository }} runId=${{ github.run_id }} siteUrl=https://quarkus.io/extensions
- run: npm run test:int
env:
CI: true
PATH_PREFIX: "${{ github.ref_name == 'main' && 'extensions' || '' }}"
PATH_PREFIX_FLAG: "${{ github.ref_name == 'main' && '--prefix-paths' || '' }}"
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
eslintrc:
- '.eslint*'
# run eslint on all files if eslintrc changes
- name: Run eslint on changed files
uses: sibiraj-s/action-eslint@v3
with:
all-files: ${{ steps.filter.outputs.eslintrc == 'true' }}
- name: Store PR id
if: "github.event_name == 'pull_request'"
run: echo ${{ github.event.number }} > ./public/pr-id.txt
- name: Publishing directory for site deployment
uses: actions/upload-artifact@v3
with:
name: site
path: ./public
retention-days: 3
deploy:
# Only try and deploy on merged code
if: "github.repository == 'quarkusio/extensions' && github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'schedule')"
needs: [ unit-test, build ]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # not needed for the code, but needed for the git config
- name: Download Built site
uses: actions/download-artifact@v3
with:
name: site
path: site
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site # The folder the action should deploy.
branch: pages