From 59f5e34352b3f34be30262f599fa8e5ef3b0db9c Mon Sep 17 00:00:00 2001 From: Jan Rous Date: Sat, 25 Nov 2023 23:25:47 -0700 Subject: [PATCH] Action that triggers docker build on push to main. --- .github/workflows/build.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..74e69dd --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,46 @@ +name: Build Docker Images +on: + push: + branches: + - main + +jobs: + build: + name: Build and push docker images + permissions: + contents: read + + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Setup Docker Metadata + id: docker_metadata + uses: docker/metadata-action@v4.4.0 + with: + images: catalystcoop/pudl-output-differ + flavor: latest=auto + tags: | + type=sha,prefix={{branch}}- + type=raw,value=latest-{{branch}} + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.docker_metadata.outputs.tags }} + labels: ${{ steps.docker_metadata.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file