Skip to content

Commit edb5ca3

Browse files
committed
Update and build workflow to fix "client version too old" issue and address deprecation warnings
Simplify checkout step Update deployment logic to switch and copy method Signed-off-by: Scott Dyer <sdyer@oscars.org>
1 parent 3fd1ee3 commit edb5ca3

File tree

1 file changed

+40
-43
lines changed

1 file changed

+40
-43
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,62 @@ on:
44
branches:
55
- dev
66
- main
7+
78
jobs:
89
docker:
9-
name: Build Mkdocs site from docker container
10+
name: Build Mkdocs site
1011
runs-on: ubuntu-latest
1112
steps:
12-
- name: Checkout dev branch
13-
if: endsWith(github.ref, '/dev')
14-
uses: actions/checkout@v2
15-
with:
16-
ref: dev
17-
fetch-depth: 0
18-
- name: Checkout main branch
19-
if: endsWith(github.ref, '/main')
20-
uses: actions/checkout@v2
13+
- name: Checkout code
14+
uses: actions/checkout@v4
2115
with:
22-
ref: main
2316
fetch-depth: 0
24-
- name: Setup git config
25-
run: |
26-
git config user.name "GitHub Actions Bot"
27-
git config user.email "<>"
28-
- name: Build docker image
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
21+
- name: Build local docker image
2922
uses: docker/build-push-action@v2
3023
with:
3124
context: .
32-
push: false
25+
load: true
3326
tags: app:latest
27+
3428
- name: Run mkdocs build via docker
3529
uses: addnab/docker-run-action@v3
3630
with:
3731
image: app:latest
38-
options: --rm -v ${{ github.workspace }}:/docs -v ${{ github.workspace }}/site:/site
32+
options: --rm -v ${{ github.workspace }}:/docs
3933
run: |
40-
git config --global --add safe.directory /docs;
41-
mkdocs build;
42-
- name: Commit dev updates to site/staging branch
34+
git config --global --add safe.directory /docs
35+
mkdocs build
36+
37+
- name: Deploy to site/staging (from dev)
4338
if: endsWith(github.ref, '/dev')
4439
run: |
45-
sudo chown -R runner:docker site;
46-
git stash -u;
47-
git fetch;
48-
git switch site/staging;
49-
rm -rf site;
50-
git clean -d -x -f;
51-
git stash pop;
52-
git add .;
53-
git commit -m 'Gitbot actions site change';
54-
git push origin;
55-
- name: Commit main updates to site/production branch
40+
git config user.name "Github Actions Bot"
41+
git config user.email "<>"
42+
sudo chown -R $USER:$USER site
43+
git fetch origin site/staging
44+
git switch site/staging
45+
rm -rf ./*
46+
cp -r site/* .
47+
rm -rf site
48+
git add .
49+
git commit -m "Deploy dev build to staging"
50+
git push origin site/staging
51+
52+
- name: Deploy to site/production (from main)
5653
if: endsWith(github.ref, '/main')
5754
run: |
58-
sudo chown -R runner:docker site;
59-
git stash -u;
60-
git fetch;
61-
git switch site/production;
62-
rm -rf site;
63-
git clean -d -x -f;
64-
git stash pop;
65-
git add .;
66-
git commit -m 'Gitbot actions site change';
67-
git push origin;
68-
55+
git config user.name "Github Actions Bot"
56+
git config user.email "<>"
57+
sudo chown -R $USER:$USER site
58+
git fetch origin site/production
59+
git switch site/production
60+
rm -rf ./*
61+
cp -r site/* .
62+
rm -rf site
63+
git add .
64+
git commit -m "Deploy main build to production"
65+
git push origin site/production

0 commit comments

Comments
 (0)