Skip to content

Commit

Permalink
Build images on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
arabcoders committed Jan 21, 2025
1 parent 547f338 commit de37955
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ on:
env:
DOCKERHUB_SLUG: arabcoders/watchstate
GHCR_SLUG: ghcr.io/arabcoders/watchstate
PLATFORMS: linux/amd64,linux/arm64,linux/arm
PLATFORMS: linux/amd64,linux/arm64

jobs:
unit-tests:
Expand Down Expand Up @@ -90,6 +90,49 @@ jobs:
- run: composer install --prefer-dist --no-interaction --no-progress
- run: composer run test

pr_build_test:
needs: unit-tests
if: github.event_name == 'pull_request'
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: bahmutov/npm-install@v1
with:
working-directory: frontend
install-command: yarn --production --prefer-offline --frozen-lockfile

- uses: bahmutov/npm-install@v1
with:
working-directory: frontend
install-command: yarn run generate

- name: Update Version File
uses: arabcoders/write-version-to-file@master
with:
filename: "/config/config.php"
placeholder: "$(version_via_ci)"
with_date: "true"
with_branch: "true"

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: ${{ env.PLATFORMS }}
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha, scope=pr_${{ github.workflow }}
cache-to: type=gha, scope=pr_${{ github.workflow }}

publish_docker_images:
needs: unit-tests
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.build == 'true')
Expand Down

0 comments on commit de37955

Please sign in to comment.