@ -1,4 +1,4 @@
name : Build & Publish Latest
name : Production
on :
on :
workflow_dispatch:
workflow_dispatch:
@ -7,15 +7,15 @@ on:
- "v*"
- "v*"
jobs:
jobs:
deploy :
docker :
name : Build & Deploy
name : Build & Deploy Docker
runs-on : ubuntu-latest
runs-on : ubuntu-latest
if : |
if : |
github.repository_owner == 'wg-easy' &&
github.repository_owner == 'wg-easy' &&
startsWith(github.ref, 'refs/tags/v')
startsWith(github.ref, 'refs/tags/v')
permissions:
permissions:
packages : write
packages : write
contents : w rit e
contents : read
steps:
steps:
- uses : actions/checkout@v4
- uses : actions/checkout@v4
@ -48,31 +48,45 @@ jobs:
with:
with:
context : .
context : .
push : true
push : true
platforms : linux/amd64,linux/arm64/v8
platforms : linux/amd64,linux/arm64
tags : ${{ steps.meta.outputs.tags }}
tags : ${{ steps.meta.outputs.tags }}
labels : ${{ steps.meta.outputs.labels }}
labels : ${{ steps.meta.outputs.labels }}
cache-from : type=gha
cache-from : type=gha
cache-to : type=gha,mode=min
cache-to : type=gha,mode=min
docs:
name : Build & Deploy Docs
runs-on : ubuntu-latest
if : |
github.repository_owner == 'wg-easy' &&
startsWith(github.ref, 'refs/tags/v')
permissions:
contents : write
needs : docker
steps:
- name : Setup Python
- name : Setup Python
uses : actions/setup-python@v5
uses : actions/setup-python@v5
with:
with:
python-version : 3.11 .9
python-version : 3.11 .9
cache : "pip"
- name : Install Dependencies
- name : Install Dependencies
run : |
run : |
pip install mkdocs-material
pip install -r docs/requirements.txt
pip install pillow cairosvg mike
- name : Setup Docs Deploy
- name : Setup Git User
run : |
run : |
git config --global user.name 'Docs Deploy Bot'
git config --global user.name 'github-actions[bot]'
git config --global user.email 'docs.deploy@users.noreply.github.com'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name : Build Docs Website
- name : Build Docs Website
run : |
run : |
cd docs
cd docs
git fetch origin gh-pages --depth=1
git fetch origin gh-pages --depth=1 || true
mike deploy --push --update-aliases ${{ github.ref_name }} latest
# latest will point to old docs if old tag is pushed
# Extract version numbers (remove 'v' prefix)
# Extract version numbers
DOCS_VERSION=${GITHUB_REF#refs/tags/} # e.g. v1.2.3 or v1.2.3-beta
DOCS_VERSION=${GITHUB_REF#refs/tags/} # e.g. v1.2.3 or v1.2.3-beta
MINOR_VERSION=$(echo $DOCS_VERSION | cut -d. -f1,2) # e.g. v1.2
MINOR_VERSION=$(echo $DOCS_VERSION | cut -d. -f1,2) # e.g. v1.2
@ -81,6 +95,6 @@ jobs:
echo "Stable release detected: $DOCS_VERSION"
echo "Stable release detected: $DOCS_VERSION"
mike deploy --push --update-aliases $MINOR_VERSION latest
mike deploy --push --update-aliases $MINOR_VERSION latest
else
else
echo "Prerelease detected: $DOCS_VERSION"
echo "Pre- release detected: $DOCS_VERSION"
mike deploy --push --update-aliases Pre-release
mike deploy --push --update-aliases Pre-release
fi
fi