Skip to content

Merge pull request #3 from abcdesktopio/3.0 #244

Merge pull request #3 from abcdesktopio/3.0

Merge pull request #3 from abcdesktopio/3.0 #244

Workflow file for this run

name: abcdesktoptemplatebuilder
on: push
env:
tag: ${{ github.ref_name }}
jobs:
job1_init_minimal:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setmatrix.outputs.matrix }}
level0: ${{ steps.setmatrix.outputs.level0 }}
level1: ${{ steps.setmatrix.outputs.level1 }}
level2: ${{ steps.setmatrix.outputs.level2 }}
level3: ${{ steps.setmatrix.outputs.level3 }}
nvidia: ${{ steps.setmatrix.outputs.nvidia }}
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Dump docker files
# list dockerfile from json files
id: dumpdockerfiles
run: |
./scripts/list-dockerfile.sh > dockerfiles
cat dockerfiles
- name: create artifact dockerfiles
uses: actions/upload-artifact@v3
with:
name: dockerfiles
path: dockerfiles
- name: Dump template images
# Dump template images from json files
id: dumptemplateimagefiles
run: |
./scripts/list-templateimage.sh > templateimages
cat templateimages
- name: create artifact template image
uses: actions/upload-artifact@v3
with:
name: templateimages
path: templateimages
# create matrix build
- name: Set Dynamic Matrix
id: setmatrix
run: |
echo tag ${{ env.tag }}
# use node to safe load the json file
mininaljson=$(node rules/json2nop.js rules/minimal.json)
echo "::set-output name=matrix::${mininaljson}"
# level0
# use node to safe load the json file
level0json=$(node rules/json2nop.js rules/level0.json)
echo "::set-output name=level0::${level0json}"
# level1
# use node to safe load the json file
level1json=$(node rules/json2nop.js rules/level1.json)
echo "::set-output name=level1::${level1json}"
# level2
# use node to safe load the json file
level2json=$(node rules/json2nop.js rules/level2.json)
echo "::set-output name=level2::${level2json}"
# level3
# use node to safe load the json file
level3json=$(node rules/json2nop.js rules/level3.json)
echo "::set-output name=level3::${level3json}"
# nvidia
# use node to safe load the json file
nvidiajson=$(node rules/json2nop.js rules/nvidia.json)
echo "::set-output name=nvidia::${nvidiajson}"
job2_do_nvidia:
needs: job1_init_minimal
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.job1_init_minimal.outputs.nvidia) }}
steps:
- run: echo Run source ${{ matrix.source }}
- run: echo Run target ${{ matrix.target }}
- run: echo Run dockerfile ${{ matrix.dockerfile }}
- run: echo tag ${{ env.tag }}
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push ${{ matrix.target }}
uses: docker/build-push-action@v3
with:
file: ${{ matrix.dockerfile }}
context: .
platforms: linux/amd64, linux/arm64
build-args: |
BASE_IMAGE=${{ matrix.source }}
push: true
tags: |
abcdesktopio/${{ matrix.target }}:${{ env.tag }}
- name: create md file ${{ matrix.target }}
run: |
node make-docs.js ${{ matrix.source }} ${{ matrix.target }}:${{ env.tag }} ${{ matrix.dockerfile }}
cat ${{ matrix.target }}.md
- name: create artifact md file ${{ matrix.target }}
uses: actions/upload-artifact@v3
with:
name: template.md
path: ${{ matrix.target }}.md
job2_do_minimal:
needs: job1_init_minimal
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.job1_init_minimal.outputs.matrix) }}
steps:
- run: echo Run ${{ matrix.source }}
- run: echo Run ${{ matrix.target }}
- run: echo Run ${{ matrix.dockerfile }}
- run: echo tag ${{ env.tag }}
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Dump Dockerfile
run: |
echo Dockerfile ${{ matrix.dockerfile }}
cat ${{ matrix.dockerfile }}
- name: Build and push ${{ matrix.target }}
# build-args: minimal does not need TAG=${{ env.tag }}
uses: docker/build-push-action@v3
with:
file: ${{ matrix.dockerfile }}
context: .
platforms: linux/amd64, linux/arm64
build-args: |
BASE_IMAGE=${{ matrix.source }}
push: true
tags: |
abcdesktopio/${{ matrix.target }}:${{ env.tag }}
- name: Use Node.js
uses: actions/setup-node@v3
- name: create md file ${{ matrix.target }}
run: |
node make-docs.js ${{ matrix.source }} ${{ matrix.target }}:${{ env.tag }} ${{ matrix.dockerfile }}
cat ${{ matrix.target }}.md
- name: create artifact md file ${{ matrix.target }}
uses: actions/upload-artifact@v3
with:
name: template.md
path: ${{ matrix.target }}.md
job3_do_level0:
needs: [ job2_do_minimal, job1_init_minimal ]
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.job1_init_minimal.outputs.level0) }}
steps:
- run: echo Run source ${{ matrix.source }}
- run: echo Run target ${{ matrix.target }}
- run: echo Run dockerfile ${{ matrix.dockerfile }}
- run: echo tag ${{ env.tag }}
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ github.ref_name }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push ${{ matrix.target }}
uses: docker/build-push-action@v3
with:
file: ${{ matrix.dockerfile }}
context: .
platforms: linux/amd64, linux/arm64
build-args: |
BASE_IMAGE=${{ matrix.source }}
TAG=${{ env.tag }}
push: true
tags: |
abcdesktopio/${{ matrix.target }}:${{ env.tag }}
- name: Use Node.js
uses: actions/setup-node@v3
- name: create md file ${{ matrix.target }}
run: |
node make-docs.js ${{ matrix.source }} ${{ matrix.target }}:${{ env.tag }} ${{ matrix.dockerfile }}
cat ${{ matrix.target }}.md
- name: create artifact md file ${{ matrix.target }}
uses: actions/upload-artifact@v3
with:
name: template.md
path: ${{ matrix.target }}.md
job4_do_level1:
needs: [ job3_do_level0, job1_init_minimal ]
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.job1_init_minimal.outputs.level1) }}
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ github.ref_name }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push ${{ matrix.target }}
uses: docker/build-push-action@v3
with:
file: ${{ matrix.dockerfile }}
context: .
platforms: linux/amd64, linux/arm64
build-args: |
BASE_IMAGE=${{ matrix.source }}
TAG=${{ env.tag }}
push: true
tags: |
abcdesktopio/${{ matrix.target }}:${{ env.tag }}
- name: Use Node.js
uses: actions/setup-node@v3
- name: create md file ${{ matrix.target }}
run: |
node make-docs.js ${{ matrix.source }} ${{ matrix.target }}:${{ env.tag }} ${{ matrix.dockerfile }}
cat ${{ matrix.target }}.md
- name: create artifact md file ${{ matrix.target }}
uses: actions/upload-artifact@v3
with:
name: template.md
path: ${{ matrix.target }}.md
job5_do_level2:
needs: [ job4_do_level1, job1_init_minimal ]
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.job1_init_minimal.outputs.level2) }}
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ github.ref_name }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push ${{ matrix.target }}
uses: docker/build-push-action@v3
with:
file: ${{ matrix.dockerfile }}
context: .
platforms: linux/amd64, linux/arm64
build-args: |
BASE_IMAGE=${{ matrix.source }}
TAG=${{ env.tag }}
push: true
tags: |
abcdesktopio/${{ matrix.target }}:${{ env.tag }}
- name: Use Node.js
uses: actions/setup-node@v3
- name: create md file ${{ matrix.target }}
run: |
node make-docs.js ${{ matrix.source }} ${{ matrix.target }}:${{ env.tag }} ${{ matrix.dockerfile }}
cat ${{ matrix.target }}.md
- name: create artifact md file ${{ matrix.target }}
uses: actions/upload-artifact@v3
with:
name: template.md
path: ${{ matrix.target }}.md
job6_do_level3:
needs: [ job5_do_level2, job1_init_minimal ]
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.job1_init_minimal.outputs.level3) }}
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ github.ref_name }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push ${{ matrix.target }}
uses: docker/build-push-action@v3
with:
file: ${{ matrix.dockerfile }}
context: .
platforms: linux/amd64
build-args: |
BASE_IMAGE=${{ matrix.source }}
TAG=${{ env.tag }}
push: true
tags: |
abcdesktopio/${{ matrix.target }}:${{ env.tag }}
- name: Use Node.js
uses: actions/setup-node@v3
- name: create md file ${{ matrix.target }}
run: |
node make-docs.js ${{ matrix.source }} ${{ matrix.target }}:${{ env.tag }} ${{ matrix.dockerfile }}
cat ${{ matrix.target }}.md
- name: create artifact md file ${{ matrix.target }}
uses: actions/upload-artifact@v3
with:
name: template.md
path: ${{ matrix.target }}.md
if-no-files-found: error # 'error' or 'ignore' are also available, defaults to `warn`
dispatch:
needs: [ job6_do_level3, job1_init_minimal ]
runs-on: ubuntu-latest
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.TOKEN_DISPATCH }}
repository: abcdesktopio/docs
event-type: dispatch-from-oc.template
client-payload: '{ "repository": "${{ github.repository }}", "run_id": "${{ github.run_id }}", "artifact": "template.md" }'