mirror of
https://github.com/gomods/athens
synced 2026-02-03 08:40:31 +00:00
feat: build docs and publish to GitHub pages (#2067)
* try: build docs * try: build docs * try: publish * try: verify publishing works on fork * try: verify publishing works on fork * try: publish pages using actions/deploy-pages * try: publish pages using actions/deploy-pages * try: publish pages using actions/deploy-pages * try: publish pages using actions/deploy-pages * feat: build docs and deploy to GitHub pages * fix: run on PRs for main * try: baseURL with custom domain * try: baseURL with custom domain * fix: revert baseURL with custom domain, it works.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
name: Build docs and deploy GitHub Pages
|
||||
on:
|
||||
push: # run on any branch, but deploy only on main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch: # allow this task to be manually started
|
||||
|
||||
jobs:
|
||||
build-docs:
|
||||
name: Run build docs
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO_VERSION: 1.25.1
|
||||
HUGO_VERSION: 0.125.1
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
cache: false
|
||||
|
||||
- name: Create directory for user-specific executable files
|
||||
run: |
|
||||
mkdir -p "${HOME}/.local"
|
||||
|
||||
- name: Install Hugo
|
||||
run: |
|
||||
curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
mkdir "${HOME}/.local/hugo"
|
||||
tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}"
|
||||
|
||||
- name: Build the site
|
||||
run: |
|
||||
hugo --gc --minify --source ./docs
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: ./docs/public
|
||||
|
||||
deploy:
|
||||
if: github.ref == 'refs/heads/main'
|
||||
permissions:
|
||||
id-token: write
|
||||
pages: write
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-docs
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM alpine:3.8 as builder
|
||||
FROM alpine:3.8 AS builder
|
||||
|
||||
ARG HUGO_VERSION=0.125.1
|
||||
ENV HUGO_BINARY=hugo_${HUGO_VERSION}_Linux-64bit.tar.gz
|
||||
|
||||
Reference in New Issue
Block a user