mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 17:56:30 -05:00
fix(ci): modify backend docker workflow to work with forks
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
9f86617a52
commit
549cfefc3f
1 changed files with 13 additions and 5 deletions
18
.github/workflows/backend-docker.yml
vendored
18
.github/workflows/backend-docker.yml
vendored
|
@ -7,11 +7,17 @@ name: Backend / Docker
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ develop ]
|
branches: [ develop ]
|
||||||
|
pull_request_target:
|
||||||
|
branches: [ develop ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ develop ]
|
branches: [ develop ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
group: ${{ github.workflow }}-${{ !!github.event.pull_request && github.event.pull_request.head.label || github.ref }}-${{ github.event_name }}-${{ github.job }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -38,6 +44,7 @@ jobs:
|
||||||
- '.yarn/**'
|
- '.yarn/**'
|
||||||
|
|
||||||
build-dev:
|
build-dev:
|
||||||
|
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
|
||||||
needs: changes
|
needs: changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -70,7 +77,7 @@ jobs:
|
||||||
|
|
||||||
sqlite-test:
|
sqlite-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: needs.changes.outputs.changed == 'true'
|
if: needs.changes.outputs.changed == 'true' && (github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork
|
||||||
needs: [ build-dev, changes ]
|
needs: [ build-dev, changes ]
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||||
|
@ -79,7 +86,7 @@ jobs:
|
||||||
|
|
||||||
sqlite-e2e:
|
sqlite-e2e:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: needs.changes.outputs.changed == 'true'
|
if: needs.changes.outputs.changed == 'true' && (github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork
|
||||||
needs: [ build-dev, changes ]
|
needs: [ build-dev, changes ]
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||||
|
@ -88,6 +95,7 @@ jobs:
|
||||||
|
|
||||||
build-prod:
|
build-prod:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: (github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork
|
||||||
needs: [ sqlite-test, sqlite-e2e, changes ]
|
needs: [ sqlite-test, sqlite-e2e, changes ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
@ -114,7 +122,7 @@ jobs:
|
||||||
if: needs.changes.outputs.changed == 'true'
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- name: Login to GHCR
|
- name: Login to GHCR
|
||||||
if: github.event_name != 'pull_request' && needs.changes.outputs.changed == 'true'
|
if: github.event_name == 'push' && needs.changes.outputs.changed == 'true'
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
|
@ -125,7 +133,7 @@ jobs:
|
||||||
if: needs.changes.outputs.changed == 'true'
|
if: needs.changes.outputs.changed == 'true'
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name == 'push' }}
|
||||||
file: backend/docker/Dockerfile
|
file: backend/docker/Dockerfile
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
Loading…
Reference in a new issue