mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-21 23:20:23 +00:00
test docker build
This commit is contained in:
parent
04480cabed
commit
14ed83e04e
2 changed files with 13 additions and 26 deletions
37
.github/workflows/docker.yml
vendored
37
.github/workflows/docker.yml
vendored
|
@ -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,10 +69,8 @@ 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/workflow-dispatch-action@v1.1.0
|
||||
id: startAndWaitWorkflow
|
||||
with:
|
||||
|
@ -86,25 +78,20 @@ jobs:
|
|||
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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# This file can running at actions
|
||||
# modify time: 202312110950, you can modify here to trigger Docker Build action
|
||||
# modify time: 202312111001, you can modify here to trigger Docker Build action
|
||||
|
||||
|
||||
FROM python:3.10-slim-bullseye
|
||||
|
|
Loading…
Reference in a new issue