|
6 | 6 | - "main"
|
7 | 7 |
|
8 | 8 | jobs:
|
9 |
| - generate-matrix: |
10 |
| - runs-on: ubuntu-latest |
11 |
| - outputs: |
12 |
| - matrix: ${{ steps.set-matrix.outputs.matrix }} |
13 |
| - run_docker_jobs: ${{ steps.set-run-docker-jobs.outputs.run_docker_jobs }} |
14 |
| - steps: |
15 |
| - - name: Checkout code |
16 |
| - uses: actions/checkout@v3 |
17 |
| - with: |
18 |
| - fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} |
19 |
| - - name: Set Matrix |
20 |
| - id: set-matrix |
21 |
| - run: | |
22 |
| - echo "matrix=$(python3 bin/generate_matrix.py submittyrpi ${{ github.event.before }} ${{ github.event.after }})" >> $GITHUB_OUTPUT |
23 |
| - - name: List Matrix |
24 |
| - run: | |
25 |
| - echo ${{ steps.set-matrix.outputs.matrix }} |
26 |
| - - name: Set Run Condition |
27 |
| - id: set-run-docker-jobs |
28 |
| - run: | |
29 |
| - num_to_build=$(echo '${{ steps.set-matrix.outputs.matrix }}' | jq '.include | length') |
30 |
| - if [[ "$num_to_build" -eq 0 ]]; then |
31 |
| - echo "run_docker_jobs=false" >> $GITHUB_OUTPUT |
32 |
| - else |
33 |
| - echo "run_docker_jobs=true" >> $GITHUB_OUTPUT |
34 |
| - fi |
35 |
| - docker: |
36 |
| - needs: |
37 |
| - - generate-matrix |
38 |
| - if: needs.generate-matrix.outputs.run_docker_jobs == 'true' |
39 |
| - runs-on: ubuntu-latest |
40 |
| - strategy: |
41 |
| - fail-fast: true |
42 |
| - matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} |
43 |
| - steps: |
44 |
| - - name: Check out repo |
45 |
| - uses: actions/checkout@v3 |
46 |
| - - name: Set up QEMU |
47 |
| - uses: docker/setup-qemu-action@v3 |
48 |
| - - name: Set up Docker Buildx |
49 |
| - uses: docker/setup-buildx-action@v3 |
50 |
| - - name: Docker Hub login |
51 |
| - uses: docker/login-action@releases/v1 |
52 |
| - with: |
53 |
| - username: ${{ secrets.DOCKER_USERNAME_SUBMITTYRPI }} |
54 |
| - password: ${{ secrets.DOCKER_PASSWORD_SUBMITTYRPI }} |
55 |
| - - name: Build and push docker |
56 |
| - uses: docker/build-push-action@v4 |
57 |
| - with: |
58 |
| - context: ${{ matrix.context }} |
59 |
| - push: true |
60 |
| - tags: ${{ matrix.tags }} |
61 |
| - platforms: linux/amd64,linux/arm64 |
62 |
| - |
| 9 | + call-docker-build-push: |
| 10 | + uses: submitty/action-docker-build/.github/workflows/[email protected] |
| 11 | + with: |
| 12 | + push: true |
| 13 | + docker_username: ${{ vars.docker_username }} |
| 14 | + base_commit: ${{ github.event.before }} |
| 15 | + head_commit: ${{ github.event.after }} |
| 16 | + secrets: |
| 17 | + docker_password: ${{ secrets.docker_password }} |
0 commit comments