Skip to content

Test for new workflow #166

Test for new workflow

Test for new workflow #166

# 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: Push to main
env:
CI_COMMIT_AUTHOR: 1bl4z3r
CI_COMMIT_EMAIL: [email protected]
SRC_FOLDER_PATH: '.'
TARGET_BRANCH: 'main'
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
git branch --set-upstream-to origin/${{ env.TARGET_BRANCH }}
git add archetypes/* assets/* layouts/* images/screenshot.jpg images/tn.jpg LICENSE README.md theme.toml hugo.toml.example
git status
git diff-index --quiet HEAD || git commit --verbose -asm "${{ github.event.head_commit.message }}"
git fetch origin
#git rebase origin/${{ env.TARGET_BRANCH }} #git rebase --strategy-option=theirs origin/${{ env.TARGET_BRANCH }}
git push origin ${{ env.TARGET_BRANCH }} --verbose --force
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 --logLevel debug && 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