Fix dead link #21
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
# Sample workflow for building and deploying a Hugo site to GitHub Pages | |
name: Deploy Website | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["master"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Allow one concurrent deployment | |
concurrency: | |
group: "publish" | |
cancel-in-progress: true | |
env: | |
WEBSITE_SOURCES_DIR: sources | |
WEBSITE_CONTENT_REPO: eclipse-glsp/glsp-website | |
WEBSITE_CONTENT_DIR: hugo-public-dist | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: ${{ env.WEBSITE_SOURCES_DIR }} | |
- name: Checkout content website | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.WEBSITE_CONTENT_REPO }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: ${{ env.WEBSITE_CONTENT_DIR }} | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: '0.78.1' | |
extended: true | |
- name: Prune current content | |
working-directory: ${{ env.WEBSITE_CONTENT_DIR }} | |
run: git rm -rf * | |
- name: Build website | |
working-directory: ${{ env.WEBSITE_SOURCES_DIR }} | |
env: | |
# For maximum backward compatibility with Hugo modules | |
HUGO_ENVIRONMENT: production | |
HUGO_ENV: production | |
run: hugo --minify -d ${{ github.workspace }}/${{ env.WEBSITE_CONTENT_DIR }} | |
- name: Check for content changes | |
id: git-check | |
working-directory: ${{ env.WEBSITE_CONTENT_DIR }} | |
run: | | |
git add -A | |
echo ::set-output name=modified::$(if git diff --cached --exit-code --quiet; then echo "false"; else echo "true"; fi) | |
- name: Push content changes | |
if: steps.git-check.outputs.modified == 'true' | |
working-directory: ${{ env.WEBSITE_CONTENT_DIR }} | |
run: | | |
git config user.name ${{ github.event.head_commit.author.name }} | |
git config user.email ${{ github.event.head_commit.author.email }} | |
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | xargs -L1 git config --unset-all | |
git remote set-url origin https://x-access-token:${{ secrets.GH_ACTION_TOKEN }}@github.com/${{ env.WEBSITE_CONTENT_REPO }} | |
git commit -am "${{ github.event.head_commit.message }}" | |
git push origin |