Skip to content

Commit 0a92b7d

Browse files
committed
Review actions workflow to use mike and branch-based deploy
Signed-off-by: Federico Busetti <729029+febus982@users.noreply.github.com>
1 parent 553edac commit 0a92b7d

File tree

3 files changed

+79
-70
lines changed

3 files changed

+79
-70
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Deploy static content to Pages
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
8+
9+
jobs:
10+
site:
11+
uses: ./.github/workflows/reusable-github-pages.yml
12+
with:
13+
site-version: "dev"

.github/workflows/github-pages.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
site-version:
5+
required: true
6+
type: string
7+
version-alias:
8+
required: false
9+
type: string
10+
default: ""
11+
set-default:
12+
required: false
13+
type: boolean
14+
default: false
15+
16+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
17+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
18+
# NOTE: There's no option to not cancel pending jobs, but we should be able to avoid race conditions on
19+
# the published gh-pages branch anyway. The expectation is to have at maximum one running process
20+
# (after merging to main) and one release process waiting.
21+
concurrency:
22+
group: "pages"
23+
cancel-in-progress: false
24+
25+
jobs:
26+
build_deploy_pages:
27+
runs-on: ubuntu-latest
28+
environment:
29+
name: github-pages
30+
31+
permissions:
32+
contents: write
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v3
37+
38+
- name: Set up Python 3.12
39+
uses: actions/setup-python@v4
40+
with:
41+
python-version: "3.12"
42+
43+
- name: Install dependencies
44+
run: |
45+
python -m pip install --upgrade pip
46+
python -m pip install poetry
47+
poetry config virtualenvs.create false
48+
poetry install --no-root --with dev
49+
50+
- name: Configure Git user
51+
run: |
52+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
53+
git config --local user.name "github-actions[bot]"
54+
55+
- name: Make sure previous versions are available to mike
56+
run: |
57+
git fetch origin gh-pages --depth=1
58+
59+
- name: Build and deploy static pages
60+
run: |
61+
mike deploy ${{ inputs.site-version }} ${{ inputs.version-alias }} --update-aliases --push
62+
63+
- name: Set default site version
64+
if: ${{ inputs.site-default }}
65+
run: |
66+
mike set-default ${{ inputs.set-version }} --push

0 commit comments

Comments
 (0)