generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (56 loc) · 1.77 KB
/
pr-open.yml
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
name: PR
on:
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
# PR open and close use the same group, allowing only one at a time
group: pr-${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true
jobs:
# https://github.com/bcgov-nr/action-builder-ghcr
builds:
if: "!github.event.pull_request.head.repo.fork"
permissions:
packages: write
runs-on: ubuntu-22.04
strategy:
matrix:
package: [postgres/postgres, postgis/postgis, bitnami/postgres]
tag: [12, 13, 14, 15, 16]
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Get first tag
id: tag
run: |
TAG=$(grep '^FROM' database/${{ matrix.package }}/${{ matrix.tag }}/Dockerfile | cut -d':' -f2)
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Build or import
uses: bcgov-nr/[email protected]
with:
build_context: database/${{ matrix.package }}/${{ matrix.tag }}
package: ${{ matrix.package }}
tag: ${{ steps.tag.outputs.tag }}
token: ${{ github.token }}
triggers: database/${{ matrix.package}}/${{ matrix.triggers }}
ghcr-cleanup:
needs: [builds]
runs-on: ubuntu-22.04
strategy:
matrix:
package: [postgres/postgres, postgis/postgis, bitnami/postgres]
steps:
- uses: actions/delete-package-versions@v4
with:
package-name: ${{ github.event.repository.name }}/${{ matrix.package }}
package-type: 'container'
min-versions-to-keep: 0
delete-only-untagged-versions: 'true'
wrap-up:
needs: [ghcr-cleanup]
runs-on: ubuntu-22.04
steps:
- name: Wrap-up
run: |
echo "Dummy step for workflow completion"