Skip to content

Commit

Permalink
Remove bin dir and change to reusable action (#24)
Browse files Browse the repository at this point in the history
* Remove bin dir and change to reusable action

* Update push to true
  • Loading branch information
cjreed121 authored Jul 12, 2024
1 parent de96fa2 commit 397bfab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 179 deletions.
63 changes: 9 additions & 54 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,12 @@ on:
- "main"

jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
run_docker_jobs: ${{ steps.set-run-docker-jobs.outputs.run_docker_jobs }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
- name: Set Matrix
id: set-matrix
run: |
echo "matrix=$(python3 bin/generate_matrix.py submittyrpi ${{ github.event.before }} ${{ github.event.after }})" >> $GITHUB_OUTPUT
- name: List Matrix
run: |
echo ${{ steps.set-matrix.outputs.matrix }}
- name: Set Run Condition
id: set-run-docker-jobs
run: |
num_to_build=$(echo '${{ steps.set-matrix.outputs.matrix }}' | jq '.include | length')
if [[ "$num_to_build" -eq 0 ]]; then
echo "run_docker_jobs=false" >> $GITHUB_OUTPUT
else
echo "run_docker_jobs=true" >> $GITHUB_OUTPUT
fi
docker:
needs:
- generate-matrix
if: needs.generate-matrix.outputs.run_docker_jobs == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Hub login
uses: docker/login-action@releases/v1
with:
username: ${{ secrets.DOCKER_USERNAME_SUBMITTYRPI }}
password: ${{ secrets.DOCKER_PASSWORD_SUBMITTYRPI }}
- name: Build and push docker
uses: docker/build-push-action@v4
with:
context: ${{ matrix.context }}
push: true
tags: ${{ matrix.tags }}
platforms: linux/amd64,linux/arm64

call-docker-build-push:
uses: submitty/action-docker-build/.github/workflows/[email protected]
with:
push: true
docker_username: ${{ vars.docker_username }}
base_commit: ${{ github.event.before }}
head_commit: ${{ github.event.after }}
secrets:
docker_password: ${{ secrets.docker_password }}
125 changes: 0 additions & 125 deletions bin/generate_matrix.py

This file was deleted.

0 comments on commit 397bfab

Please sign in to comment.