Add to explaining configs #85 #119
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
# Main Workflow | |
# Trigger on every commit to staging | |
name: Action on push to staging | |
on: | |
push: | |
branches: | |
- staging | |
pull_request: | |
branches: | |
- staging | |
workflow_dispatch: | |
jobs: | |
copy-theme-to-main: | |
name: Copy Themes content to main branch | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Copy Files | |
env: | |
SRC_FOLDER_PATH: '.' | |
TARGET_BRANCH: 'main' | |
run: | | |
files=$(find $SRC_FOLDER_PATH -type f|grep -v 'resources\|git\|static\|content\|public\|hugo.toml$\|assets/custom\|928-600x400.jpg\|images/favicon.svg\|hugo_build.lock\|i18n\|hermit.webp\|screenshot.gif') # get the file list | |
git config --global user.name 'GitHub Action' | |
git config --global user.email '[email protected]' | |
git fetch # fetch branches | |
git checkout $TARGET_BRANCH # checkout to your branch | |
git checkout ${GITHUB_REF##*/} -- $files # copy files from the source branch | |
git add -A | |
git diff-index --quiet HEAD || git commit -asm "${{ github.event.head_commit.message }}" # commit to the repository (ignore if no modification) | |
git push origin $TARGET_BRANCH # push to remote branch | |
analyze: | |
name: Analyze (${{ matrix.language }}) | |
runs-on: ubuntu-latest | |
timeout-minutes: 360 | |
permissions: | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- language: javascript-typescript | |
build-mode: none | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: ${{ matrix.language }} | |
build-mode: ${{ matrix.build-mode }} | |
- if: matrix.build-mode == 'manual' | |
run: | | |
echo 'If you are using a "manual" build mode for one or more of the' \ | |
'languages you are analyzing, replace this with the commands to build' \ | |
'your code, for example:' | |
echo ' make bootstrap' | |
echo ' make release' | |
exit 1 | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
with: | |
category: "/language:${{matrix.language}}" | |
build-and-deploy-site: | |
name: Build and Deploy Hugo | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: 'latest' | |
extended: true | |
- name: Build site with Hugo | |
run: hugo --minify --noBuildLock --ignoreCache --gc --verbose && cp public/en/404.html public/404.html | |
- name: Deploy to GitHub Pages | |
if: github.event_name == 'push' && github.ref == 'refs/heads/staging' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
publish_branch: gh-pages |