add pages action

This commit is contained in:
Darren 2023-12-10 10:36:32 +08:00 committed by GitHub
parent a9ac5f6706
commit 769c4dc7ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 18 deletions

View file

@ -3,6 +3,7 @@
# 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
@ -12,6 +13,8 @@ on:
paths:
- "docker/*/Dockerfile"
jobs:
setup:
runs-on: ubuntu-latest
@ -34,6 +37,9 @@ jobs:
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:
@ -69,7 +75,8 @@ jobs:
echo "DIRECTORY=docker/$APP" >> $GITHUB_ENV
echo "README=docker/$APP/README.md" >> $GITHUB_ENV
##------------ special task for apphub begin----------------------#
## begin----------- special task for apphub----------------------#
- name: Trigger media.yml workflow
uses: mathze/workflow-dispatch-action@v1.1.0
id: startAndWaitWorkflow
@ -78,20 +85,26 @@ jobs:
token: ${{github.token}}
run-id: dummy
wait-interval: PT10S
if: env.APP == 'apphub'
if: env.APP == 'apphub' && if env.MEDIA_FROM == 'source'
- name: Reuse workflow run id
- name: Wait for Workflow
run: "echo ${{ steps.startAndWaitWorkflow.outputs.run-id }}"
if: env.APP == 'apphub'
if: env.APP == 'apphub' && if env.MEDIA_FROM == 'source'
- name: Download media.zip from artifacts
- name: Download media.zip from action artifact
uses: Legit-Labs/action-download-artifact@v2
with:
workflow: media.yml
name: media
path: ${{env.DIRECTORY}}
if: env.APP == 'apphub'
##------------ special task for apphub end----------------------#
if: env.APP == 'apphub' && if env.MEDIA_FROM == 'source'
- name: Download media-latest.zip from Websoft9 artifact
run: |
curl -o media.zip https://w9artifact.blob.core.windows.net/release/websoft9/plugin/media/media-latest.zip
if env.MEDIA_FROM == 'artifact'
## end------------ special task for apphub ---------------------#
- name: Build & push Docker image
uses: mr-smithers-excellent/docker-build-push@v6

View file

@ -7,9 +7,15 @@ on:
paths:
- "version.json"
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
upload_artifact:
name: Bupload_artifact
name: upload_artifact
runs-on: ubuntu-latest
steps:
@ -70,7 +76,7 @@ jobs:
delete_if_exists: true
fail_if_source_empty: true
- name: Create Release
- name: Create Github Release
uses: softprops/action-gh-release@v1
with:
files: |
@ -125,4 +131,27 @@ jobs:
container_name: $web
connection_string: ${{ secrets.Azure_blob }}
extra_args: '--destination-path ./apidocs'
overwrite: true
overwrite: true
pages:
name: Build Github Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3

View file

@ -1,5 +1,5 @@
# This file can running at actions
# If you build this image on local, need download media.zip from websoft9_artifact to docker/apphub directory
# If you build this image on local, need download media.zip from WEBSOFT9_ARTIFACT to docker/apphub directory
# modify time: 202312081919, you can modify here to trigger Docker Build action
@ -10,17 +10,17 @@ LABEL version="0.0.6"
WORKDIR /websoft9
ENV websoft9_repo="https://github.com/Websoft9/websoft9"
ENV websoft9_artifact="https://w9artifact.blob.core.windows.net/release/websoft9"
ENV library_repo="https://github.com/Websoft9/docker-library"
ENV source_github_pages="https://websoft9.github.io/websoft9"
ARG WEBSOFT9_REPO="https://github.com/Websoft9/websoft9"
ARG WEBSOFT9_ARTIFACT="https://w9artifact.blob.core.windows.net/release/websoft9"
ARG LIBRARY_REPO="https://github.com/Websoft9/docker-library"
ARG SOURCE_GITHUB_PAGES="https://websoft9.github.io/websoft9"
COPY media.zip /websoft9
RUN apt update && apt install -y --no-install-recommends curl git jq cron iproute2 supervisor rsync wget unzip zip && \
# download docker-library
git clone --depth=1 $library_repo && \
git clone --depth=1 $LIBRARY_REPO && \
mv docker-library w9library && \
rm -rf w9library/.github && \
ls -la && \
@ -29,14 +29,14 @@ RUN apt update && apt install -y --no-install-recommends curl git jq cron iprout
git clone --depth=1 https://github.com/swagger-api/swagger-ui.git && \
wget https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js && \
cp redoc.standalone.js swagger-ui/dist && \
git clone --depth=1 $websoft9_repo ./w9source && \
git clone --depth=1 $WEBSOFT9_REPO ./w9source && \
cp -r ./w9media ./media && \
cp -r ./w9library ./library && \
cp -r ./w9source/apphub ./apphub && \
cp -r ./swagger-ui/dist ./apphub/swagger-ui && \
cp -r ./w9source/apphub/src/config ./config && \
cp -r ./w9source/docker/apphub/script ./script && \
curl -o ./script/update_zip.sh $source_github_pages/scripts/update_zip.sh && \
curl -o ./script/update_zip.sh $SOURCE_GITHUB_PAGES/scripts/update_zip.sh && \
pip install --no-cache-dir --upgrade -r apphub/requirements.txt && \
pip install -e ./apphub && \
# Clean cache and install files