Download documentation in amd64 build and further reduce code duplication

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-03-09 07:41:47 +01:00
parent 4019bd7745
commit af7d521bfc
3 changed files with 55 additions and 31 deletions
+33
View File
@@ -20,6 +20,26 @@ inputs:
event_name:
required: true
description: The name of the event that triggered the workflow run
actor:
required: true
description: The name of the user or app that initiated the workflow run
target_dir:
required: true
description: The directory to deploy the artifacts to
# Secrets cannot be accessed in the action.yml file so we need to pass them as
# inputs to the action.
SSH_KEY:
required: true
description: The SSH private key to use for authentication
KNOWN_HOSTS:
required: true
description: The SSH known hosts file
SSH_USER:
required: true
description: The SSH user to use for authentication
SSH_HOST:
required: true
description: The SSH host to connect to
# Both the definition of environment variables and checking out the code
# needs to be done outside of the composite action as
@@ -91,3 +111,16 @@ runs:
with:
name: pihole-api-docs
path: 'api-docs.tar.gz'
-
name: Deploy
if: inputs.event_name != 'pull_request'
uses: ./.github/actions/deploy
with:
pattern: ${{ inputs.bin_name }}-binary
target_dir: ${{ inputs.target_dir }}
event_name: ${{ inputs.event_name }}
actor: ${{ inputs.actor }}
SSH_KEY: ${{ inputs.SSH_KEY }}
KNOWN_HOSTS: ${{ inputs.KNOWN_HOSTS }}
SSH_USER: ${{ inputs.SSH_USER }}
SSH_HOST: ${{ inputs.SSH_HOST }}
+13 -1
View File
@@ -33,13 +33,20 @@ runs:
using: "composite"
steps:
-
name: Get binaries (and possibly documentation) built in previous jobs
name: Get binaries built in previous jobs
uses: actions/download-artifact@v4.1.4
id: download
with:
path: ftl_builds/
pattern: ${{ inputs.pattern }}
merge-multiple: true
-
name: Get documentation files built in previous jobs
if: inputs.pattern == 'pihole-FTL-amd64-binary'
uses: actions/download-artifact@v4.1.4
with:
path: ftl_builds/
name: pihole-api-docs
-
name: Display structure of downloaded files
shell: bash
@@ -50,7 +57,12 @@ runs:
uses: benoitchantre/setup-ssh-authentication-action@1.0.1
with:
private-key: ${{ inputs.SSH_KEY }}
private-key-name: id_rsa
known-hosts: ${{ inputs.KNOWN_HOSTS }}
-
name: Set private key permissions
shell: bash
run: chmod 600 ~/.ssh/id_rsa
-
name: Untar documentation files
if: inputs.pattern == 'pihole-FTL-amd64-binary'
+9 -30
View File
@@ -50,7 +50,7 @@ jobs:
[[ $FAIL == 1 ]] && exit 1 || echo "Branch name depth check passed."
shell: bash
build-gha-x86:
gha-x86:
runs-on: ubuntu-latest
needs: smoke-tests
strategy:
@@ -70,30 +70,23 @@ jobs:
name: Checkout code
uses: actions/checkout@v4.1.1
-
name: Build and test FTL
name: Build and test and deploy FTL
uses: ./.github/actions/build-and-test
with:
platform: ${{ matrix.platform }}
bin_name: ${{ matrix.bin_name }}
artifact_name: ${{ matrix.bin_name }}-binary
target_dir: ${{ needs.smoke-tests.outputs.OUTPUT_DIR }}
git_branch: ${{ needs.smoke-tests.outputs.GIT_BRANCH }}
git_tag: ${{ needs.smoke-tests.outputs.GIT_TAG }}
event_name: ${{ github.event_name }}
-
name: Deploy
if: github.event_name != 'pull_request'
uses: ./.github/actions/deploy
with:
pattern: ${{ matrix.bin_name }}-binary
target_dir: ${{ needs.smoke-tests.outputs.OUTPUT_DIR }}
event_name: ${{ github.event_name }}
actor: ${{ github.actor }}
SSH_KEY: ${{ secrets.SSH_KEY }}
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
SSH_USER: ${{ secrets.SSH_USER }}
SSH_HOST: ${{ secrets.SSH_HOST }}
build-gha-riscv64:
gha-riscv64:
runs-on: ubuntu-latest
needs: smoke-tests
env:
@@ -105,30 +98,23 @@ jobs:
name: Checkout code
uses: actions/checkout@v4.1.1
-
name: Build and test FTL
name: Build and test and deploy FTL
uses: ./.github/actions/build-and-test
with:
platform: linux/riscv64
bin_name: pihole-FTL-riscv64
artifact_name: pihole-FTL-riscv64-binary
target_dir: ${{ needs.smoke-tests.outputs.OUTPUT_DIR }}
git_branch: ${{ needs.smoke-tests.outputs.GIT_BRANCH }}
git_tag: ${{ needs.smoke-tests.outputs.GIT_TAG }}
event_name: ${{ github.event_name }}
-
name: Deploy
if: github.event_name != 'pull_request'
uses: ./.github/actions/deploy
with:
pattern: ${{ matrix.bin_name }}-binary
target_dir: ${{ needs.smoke-tests.outputs.OUTPUT_DIR }}
event_name: ${{ github.event_name }}
actor: ${{ github.actor }}
SSH_KEY: ${{ secrets.SSH_KEY }}
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
SSH_USER: ${{ secrets.SSH_USER }}
SSH_HOST: ${{ secrets.SSH_HOST }}
build-self-hosted:
self-hosted:
runs-on: self-hosted
needs: smoke-tests
strategy:
@@ -150,23 +136,16 @@ jobs:
name: Checkout code
uses: actions/checkout@v4.1.1
-
name: Build and test FTL
name: Build and test and deploy FTL
uses: ./.github/actions/build-and-test
with:
platform: ${{ matrix.platform }}
bin_name: ${{ matrix.bin_name }}
artifact_name: ${{ matrix.bin_name }}-binary
target_dir: ${{ needs.smoke-tests.outputs.OUTPUT_DIR }}
git_branch: ${{ needs.smoke-tests.outputs.GIT_BRANCH }}
git_tag: ${{ needs.smoke-tests.outputs.GIT_TAG }}
event_name: ${{ github.event_name }}
-
name: Deploy
if: github.event_name != 'pull_request'
uses: ./.github/actions/deploy
with:
pattern: ${{ matrix.bin_name }}-binary
target_dir: ${{ needs.smoke-tests.outputs.OUTPUT_DIR }}
event_name: ${{ github.event_name }}
actor: ${{ github.actor }}
SSH_KEY: ${{ secrets.SSH_KEY }}
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}