Only build public images on merge

This commit is contained in:
Jackson Harper
2024-02-21 14:00:46 +08:00
parent ad069089ed
commit cab239b748
2 changed files with 50 additions and 2 deletions

View File

@ -0,0 +1,32 @@
name: Run tests
on:
push:
branches:
- main
paths-ignore:
- 'apple/**'
- 'android/**'
jobs:
build-docker-images:
name: Build docker images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Login to GitHub container registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build the backend docker image
run: |
docker build . --file packages/api/Dockerfile --tag "ghcr.io/omnivore-app/backend:${GITHUB_SHA}" --tag ghcr.io/omnivore-app/backend:latest
docker push ghcr.io/omnivore-app/backend:${GITHUB_SHA}
- name: Build the content-fetch docker image
run: |
docker build --file packages/content-fetch/Dockerfile . --tag "ghcr.io/omnivore-app/content-fetch:${GITHUB_SHA}" --tag ghcr.io/omnivore-app/content-fetch:latest
docker push ghcr.io/omnivore-app/content-fetch:${GITHUB_SHA}

View File

@ -5,11 +5,13 @@ on:
- main
paths-ignore:
- 'apple/**'
- 'android/**'
pull_request:
branches:
- main
paths-ignore:
- 'apple/**'
- 'android/**'
env:
NEXT_PUBLIC_APP_ENV: prod
@ -111,11 +113,25 @@ jobs:
- name: Build the API docker image
# run: 'docker build --file packages/api/Dockerfile .'
run: |
docker build . --file packages/api/Dockerfile --tag ghcr.io/omnivore-app/backend:latest
docker push ghcr.io/omnivore-app/backend:latest
docker build . --file packages/api/Dockerfile --tag "ghcr.io/omnivore-app/backend:${GITHUB_SHA}" --tag ghcr.io/omnivore-app/backend:latest
docker push ghcr.io/omnivore-app/backend:${GITHUB_SHA}
- name: Build the content-fetch docker image
run: 'docker build --file packages/content-fetch/Dockerfile .'
- name: Build the inbound-email-handler docker image
run: 'docker build --file packages/inbound-email-handler/Dockerfile .'
- name: Build the content-fetch cloud function docker image
run: 'docker build --file packages/content-fetch/Dockerfile-gcf .'
build-docker-images:
name: Build docker images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build the API docker image
run: 'docker build --file packages/api/Dockerfile .'
- name: Build the content-fetch cloud function docker image
run: 'docker build --file packages/content-fetch/Dockerfile-gcf .'
- name: Build the inbound-email-handler docker image
run: 'docker build --file packages/inbound-email-handler/Dockerfile .'