From 26a2d806150db22dac3ea14166d26934292720e9 Mon Sep 17 00:00:00 2001 From: marcelloromani Date: Sun, 6 Nov 2022 11:19:48 +0000 Subject: [PATCH 1/4] DRY common code to build website into shared action --- .github/actions/build_website/action.yaml | 16 ++++++++++++++++ .github/workflows/build.yml | 12 ++++-------- .github/workflows/github_pages_deploy.yml | 20 +++++++++----------- 3 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 .github/actions/build_website/action.yaml diff --git a/.github/actions/build_website/action.yaml b/.github/actions/build_website/action.yaml new file mode 100644 index 0000000..3b405fe --- /dev/null +++ b/.github/actions/build_website/action.yaml @@ -0,0 +1,16 @@ +name: Build the website +description: Build the website + +runs: + using: "composite" + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Install the tutorial_web binary + shell: bash + run: /usr/bin/env python3 install.py linux + + - name: Build + shell: bash + run: ./bin/tutorial_web build -i courses -s ./bin/static -o build -b /tutorial_web_content diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9911d8..827fa34 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,15 +1,11 @@ -name: Builds the website (doesn't deploy - only used for checking syntax) +name: Build the website (doesn't deploy - only used for checking syntax) on: push jobs: - build-deploy: + build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: Install the tutorial_web binary - run: /usr/bin/env python3 install.py linux - # Build the website - - name: Build - run: ./bin/tutorial_web build -i courses -s ./bin/static -o build -b /tutorial_web_content + - name: Build + uses: ./actions/build_website diff --git a/.github/workflows/github_pages_deploy.yml b/.github/workflows/github_pages_deploy.yml index 60fa61b..31ebca0 100644 --- a/.github/workflows/github_pages_deploy.yml +++ b/.github/workflows/github_pages_deploy.yml @@ -9,14 +9,12 @@ jobs: build-deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: Install the tutorial_web binary - run: /usr/bin/env python3 install.py linux - # Build the website - - name: Build - run: ./bin/tutorial_web build -i courses -s ./bin/static -o build -b /tutorial_web_content - - name: Deploy - uses: JamesIves/github-pages-deploy-action@4.1.5 - with: - branch: gh-pages - folder: build + + - name: Build + uses: ./actions/build_website + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@4.1.5 + with: + branch: gh-pages + folder: build From a31f4d9bd1637760e0842580f33455cf0df8ad67 Mon Sep 17 00:00:00 2001 From: Marcello Romani Date: Mon, 7 Nov 2022 13:22:44 +0000 Subject: [PATCH 2/4] fix workflow trigger --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 827fa34..129e785 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,6 @@ name: Build the website (doesn't deploy - only used for checking syntax) -on: - push +on: [push, pull_request] jobs: build: From df93c578f4dee06307fc79e37ce25c6a780699ef Mon Sep 17 00:00:00 2001 From: marcelloromani Date: Tue, 8 Nov 2022 22:50:16 +0000 Subject: [PATCH 3/4] fix silly mistake: git checkout must happen in the workflow --- .github/actions/build_website/action.yaml | 3 --- .github/workflows/build.yml | 3 +++ .github/workflows/github_pages_deploy.yml | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/build_website/action.yaml b/.github/actions/build_website/action.yaml index 3b405fe..7bdd754 100644 --- a/.github/actions/build_website/action.yaml +++ b/.github/actions/build_website/action.yaml @@ -4,9 +4,6 @@ description: Build the website runs: using: "composite" steps: - - name: Checkout - uses: actions/checkout@master - - name: Install the tutorial_web binary shell: bash run: /usr/bin/env python3 install.py linux diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 129e785..56f3bb2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,5 +6,8 @@ jobs: build: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@master + - name: Build uses: ./actions/build_website diff --git a/.github/workflows/github_pages_deploy.yml b/.github/workflows/github_pages_deploy.yml index 31ebca0..d8508bc 100644 --- a/.github/workflows/github_pages_deploy.yml +++ b/.github/workflows/github_pages_deploy.yml @@ -9,6 +9,8 @@ jobs: build-deploy: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@master - name: Build uses: ./actions/build_website From 856f004110b0fc08b885cc2ba0f287a8b73363dc Mon Sep 17 00:00:00 2001 From: marcelloromani Date: Tue, 8 Nov 2022 22:51:37 +0000 Subject: [PATCH 4/4] fix action path --- .github/workflows/build.yml | 2 +- .github/workflows/github_pages_deploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56f3bb2..51a35d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,4 +10,4 @@ jobs: uses: actions/checkout@master - name: Build - uses: ./actions/build_website + uses: ./.github/actions/build_website diff --git a/.github/workflows/github_pages_deploy.yml b/.github/workflows/github_pages_deploy.yml index d8508bc..1e94fb9 100644 --- a/.github/workflows/github_pages_deploy.yml +++ b/.github/workflows/github_pages_deploy.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@master - name: Build - uses: ./actions/build_website + uses: ./.github/actions/build_website - name: Deploy uses: JamesIves/github-pages-deploy-action@4.1.5