Skip to content

Commit dabd039

Browse files
committed
Avoid uploading artifacts when deploying
As we run the build and deploy on our own self-hosted runners, avoid uploading and downloading the build to and from GitHub's servers.
1 parent afea379 commit dabd039

File tree

2 files changed

+78
-83
lines changed

2 files changed

+78
-83
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build and deploy
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
type: string
8+
url:
9+
type: string
10+
deploy:
11+
type: boolean
12+
default: false
13+
14+
jobs:
15+
build:
16+
runs-on: [self-hosted, web]
17+
environment:
18+
name: ${{ inputs.environment }}
19+
url: ${{ inputs.url }}
20+
steps:
21+
- uses: actions/checkout@v6
22+
- uses: actions/setup-python@v6
23+
with:
24+
python-version: 3.9
25+
- name: Install Python dependencies
26+
uses: py-actions/py-dependency-install@v4
27+
- name: Install Python libs
28+
run: pip3 install -r ./requirements.txt
29+
- uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: 3.2
32+
bundler-cache: true
33+
- uses: seanmiddleditch/gha-setup-ninja@v6
34+
with:
35+
version: 1.10.2
36+
- name: Install arm-none-eabi-gcc GNU Arm Embedded Toolchain
37+
if: ${{ inputs.deploy }}
38+
uses: carlosperate/arm-none-eabi-gcc-action@v1.11.0
39+
- name: Install Doxygen
40+
if: ${{ inputs.deploy }}
41+
run: |
42+
wget https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz
43+
tar xf doxygen-1.10.0.linux.bin.tar.gz -C "$HOME"
44+
echo "$HOME/doxygen-1.10.0/bin" >> $GITHUB_PATH
45+
- name: Build Doxygen documentation
46+
if: ${{ inputs.deploy }}
47+
run: make build_doxygen_adoc
48+
- name: Build documentation
49+
run: make -j 2
50+
- name: Deploy to Mythic Beasts
51+
if: ${{ inputs.deploy }}
52+
uses: ./.github/actions/deploy-action
53+
with:
54+
private_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }}
55+
public_bastion_host_keys: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
56+
bastion_host: ${{ secrets.DEPLOY_BASTION_HOST }}
57+
primary_host: ${{ secrets.DEPLOY_PRIMARY_HOST }}
58+
secondary_host: ${{ secrets.DEPLOY_SECONDARY_HOST }}
59+
source: documentation/html/
60+
destination: documentation

.github/workflows/build.yml

Lines changed: 18 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -10,90 +10,25 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: [self-hosted, web]
14-
steps:
15-
- uses: actions/checkout@v6
16-
- uses: actions/setup-python@v6
17-
with:
18-
python-version: 3.9
19-
- name: Install Python dependencies
20-
uses: py-actions/py-dependency-install@v4
21-
- name: Install Python libs
22-
run: pip3 install -r ./requirements.txt
23-
- uses: ruby/setup-ruby@v1
24-
with:
25-
ruby-version: 3.2
26-
bundler-cache: true
27-
- uses: seanmiddleditch/gha-setup-ninja@v6
28-
with:
29-
version: 1.10.2
30-
- name: Install arm-none-eabi-gcc GNU Arm Embedded Toolchain
31-
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' }}
32-
uses: carlosperate/arm-none-eabi-gcc-action@v1.11.0
33-
- name: Install Doxygen
34-
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' }}
35-
run: |
36-
wget https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz
37-
tar xf doxygen-1.10.0.linux.bin.tar.gz -C "$HOME"
38-
echo "$HOME/doxygen-1.10.0/bin" >> $GITHUB_PATH
39-
- name: Build Doxygen documentation
40-
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' }}
41-
run: make build_doxygen_adoc
42-
- name: Build documentation
43-
run: make -j 2
44-
- uses: actions/upload-artifact@v4
45-
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' }}
46-
with:
47-
name: documentation
48-
path: documentation/html/
49-
if-no-files-found: error
50-
retention-days: 1
51-
include-hidden-files: true
13+
uses: ./.github/workflows/build-and-deploy.yml
14+
if: ${{ github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/master' }}
15+
with:
16+
deploy: false
5217

53-
deploy-staging:
54-
needs: build
55-
runs-on: ubuntu-latest
56-
environment:
57-
name: staging
58-
url: ${{ vars.STAGING_URL }}
18+
staging-build:
19+
uses: ./.github/workflows/build-and-deploy.yml
5920
if: ${{ github.ref == 'refs/heads/develop' }}
60-
steps:
61-
- uses: actions/checkout@v6
62-
- uses: actions/download-artifact@v5
63-
with:
64-
name: documentation
65-
path: documentation/html
66-
- name: Deploy to Mythic Beasts
67-
uses: ./.github/actions/deploy-action
68-
with:
69-
private_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }}
70-
public_bastion_host_keys: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
71-
bastion_host: ${{ secrets.DEPLOY_BASTION_HOST }}
72-
primary_host: ${{ secrets.DEPLOY_PRIMARY_HOST }}
73-
secondary_host: ${{ secrets.DEPLOY_SECONDARY_HOST }}
74-
source: documentation/html/
75-
destination: documentation
21+
with:
22+
deploy: true
23+
environment: staging
24+
url: ${{ vars.STAGING_URL }}
25+
secrets: inherit
7626

77-
deploy-production:
78-
needs: build
79-
runs-on: ubuntu-latest
80-
environment:
81-
name: production
82-
url: ${{ vars.PRODUCTION_URL }}
27+
production-build:
28+
uses: ./.github/workflows/build-and-deploy.yml
8329
if: ${{ github.ref == 'refs/heads/master' }}
84-
steps:
85-
- uses: actions/checkout@v6
86-
- uses: actions/download-artifact@v5
87-
with:
88-
name: documentation
89-
path: documentation/html
90-
- name: Deploy to Mythic Beasts
91-
uses: ./.github/actions/deploy-action
92-
with:
93-
private_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }}
94-
public_bastion_host_keys: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
95-
bastion_host: ${{ secrets.DEPLOY_BASTION_HOST }}
96-
primary_host: ${{ secrets.DEPLOY_PRIMARY_HOST }}
97-
secondary_host: ${{ secrets.DEPLOY_SECONDARY_HOST }}
98-
source: documentation/html/
99-
destination: documentation
30+
with:
31+
deploy: true
32+
environment: production
33+
url: ${{ vars.PRODUCTION_URL }}
34+
secrets: inherit

0 commit comments

Comments
 (0)