-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04480ca
commit 14ed83e
Showing
2 changed files
with
13 additions
and
26 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 |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
# When version include "-", it not divide version and build ony one test image | ||
# It have enable multiPlatform, you add more platform at platform: linux/amd64... | ||
# If you add more paths for trigger, please update app_list= at set-matrix for it also | ||
# MEDIA_FROM environment: source | artifact, when use source get from contentful and oss, use artifact download media-latest from Websoft9 artifact | ||
|
||
name: Build image to DockerHub | ||
|
||
|
@@ -16,6 +15,8 @@ on: | |
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
@@ -26,20 +27,13 @@ jobs: | |
run: | | ||
git diff --name-only HEAD^ HEAD | ||
changed_files=$(git diff --name-only HEAD^ HEAD) | ||
app_list=$(echo "$changed_files" | grep -E 'apps/.*/(Dockerfile)' | awk -F'/' '{print $2}' | sort | uniq) | ||
if [ -z "$app_list" ]; then | ||
app_list_json='[]' | ||
else | ||
app_list_json=$(echo $app_list | jq -R -s -c 'split(" ")') | ||
fi | ||
app_list=$(echo "$changed_files" | grep -E 'docker/.*/(Dockerfile)' | awk -F'/' '{print $2}' | sort | uniq) | ||
app_list_json=$(echo $app_list | jq -R -s -c 'split(" ")') | ||
echo "::set-output name=matrix::{\"app\": $app_list_json}" | ||
build: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
env: | ||
# You can set it to choice where download from | ||
MEDIA_FROM: "source" | ||
strategy: | ||
matrix: ${{fromJson(needs.setup.outputs.matrix)}} | ||
steps: | ||
|
@@ -75,36 +69,29 @@ jobs: | |
echo "DIRECTORY=docker/$APP" >> $GITHUB_ENV | ||
echo "README=docker/$APP/README.md" >> $GITHUB_ENV | ||
##begin----------- special task for apphub----------------------# | ||
|
||
##------------ special task for apphub begin----------------------# | ||
- name: Trigger media.yml workflow | ||
if: env.APP == 'apphub' && env.MEDIA_FROM == 'source' | ||
uses: mathze/[email protected] | ||
id: startAndWaitWorkflow | ||
with: | ||
workflow-name: media.yml | ||
token: ${{github.token}} | ||
run-id: dummy | ||
wait-interval: PT10S | ||
if: env.APP == 'apphub' | ||
|
||
- name: Wait for Workflow | ||
if: env.APP == 'apphub' && env.MEDIA_FROM == 'source' | ||
- name: Reuse workflow run id | ||
run: "echo ${{ steps.startAndWaitWorkflow.outputs.run-id }}" | ||
|
||
- name: Download media.zip from action artifact | ||
if: env.APP == 'apphub' | ||
|
||
- name: Download media.zip from artifacts | ||
uses: Legit-Labs/action-download-artifact@v2 | ||
if: env.APP == 'apphub' && env.MEDIA_FROM == 'source' | ||
with: | ||
workflow: media.yml | ||
name: media | ||
path: ${{env.DIRECTORY}} | ||
|
||
- name: Download media-latest.zip from Websoft9 artifact | ||
if: env.MEDIA_FROM == 'artifact' | ||
run: | | ||
curl -o media.zip https://w9artifact.blob.core.windows.net/release/websoft9/plugin/media/media-latest.zip | ||
##end------------ special task for apphub ---------------------# | ||
if: env.APP == 'apphub' | ||
##------------ special task for apphub end----------------------# | ||
|
||
- name: Build & push Docker image | ||
uses: mr-smithers-excellent/docker-build-push@v6 | ||
|
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