Repository navigation
64 lines (57 loc) · 1.89 KB
/
Copy pathbuild.yml
File metadata and controls
64 lines (57 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Build and publish images
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
checks:
if: github.event_name == 'push'
uses: ./.github/workflows/ci.yml
package:
if: >-
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/package.yml
with:
commit: ${{ github.event.pull_request.head.sha || github.sha }}
bundles: ${{ github.event_name != 'push' }}
export_images: >-
${{ github.event_name == 'push' ||
(github.event_name == 'pull_request' &&
github.actor != 'dependabot[bot]' &&
github.event.pull_request.user.login != 'dependabot[bot]') }}
docker-pr:
needs: package
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository &&
github.actor != 'dependabot[bot]' &&
github.event.pull_request.user.login != 'dependabot[bot]'
permissions:
contents: read
packages: write
uses: ./.github/workflows/docker-publish.yml
secrets:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
with:
commit: ${{ github.event.pull_request.head.sha }}
version: ${{ needs.package.outputs.version }}
target: pr-${{ github.event.pull_request.number }}
docker:
needs: [checks, package]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: read
packages: write
uses: ./.github/workflows/docker-publish.yml
secrets: inherit
with:
commit: ${{ github.sha }}
version: ${{ needs.package.outputs.version }}
target: main