-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use matrix strategy for similar jobs to save time * update version of third-party actions * reuse workflows Issue: #1030 Signed-off-by: Ndibe Raymond Olisaemeka <[email protected]>
- Loading branch information
Ndibe Raymond Olisaemeka
committed
Dec 19, 2023
1 parent
5c506c2
commit ade434f
Showing
10 changed files
with
155 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Checkout files workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
required: false | ||
type: string | ||
repository: | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
checkout: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout files | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
repository: ${{ inputs.repository }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Docker build and push workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
context: | ||
required: true | ||
type: string | ||
file: | ||
required: true | ||
type: string | ||
tags: | ||
required: true | ||
type: string | ||
push: | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
docker_build_and_push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ inputs.context }}} | ||
file: ${{ inputs.file }} | ||
push: ${{ inputs.push }} | ||
tags: ${{ inputs.tags }} | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Copy files workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
source: | ||
required: true | ||
type: string | ||
target: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
copy_files: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Copy file via scp | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.DO_BACKEND_HOST }} | ||
username: ${{ secrets.DO_BACKEND_USERNAME }} | ||
key: ${{ secrets.DO_SSHKEY }} | ||
source: ${{ inputs.source }} | ||
target: ${{ inputs.target }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Execute remote command workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
script: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
execute_command: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Executing remote command | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.DO_BACKEND_HOST }} | ||
username: ${{ secrets.DO_BACKEND_USERNAME }} | ||
key: ${{ secrets.DO_SSHKEY }} | ||
script: ${{ inputs.script }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters