Skip to content

Commit 0fda9be

Browse files
committed
fix: ci
1 parent 318579e commit 0fda9be

File tree

1 file changed

+32
-22
lines changed

1 file changed

+32
-22
lines changed

.github/workflows/ci.yaml

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,45 @@
22
name: Build PostgreSQL images
33

44
on:
5+
# trigger every sunday morning
56
schedule:
67
- cron: "2 2 * * SUN"
8+
# trigger on PR merge and push to master branch
79
push:
10+
branches:
11+
- master
12+
# trigger on PR
13+
pull_request:
14+
branches:
15+
- master
816

917
jobs:
10-
build:
18+
build-and-push:
19+
if: github.event_name == 'push' || github.event_name == 'schedule'
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 120
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v2
1126

27+
- name: Log in to GitHub Container Registry
28+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
29+
30+
- name: Log in to Docker Hub
31+
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login docker.io -u dockerc2c --password-stdin
32+
33+
- name: Build and push with Docker
34+
run: make PUSH_DOCKER_HUB=true PUSH_GHCR=true
35+
36+
build-on-pr:
37+
if: github.event_name == 'pull_request'
1238
runs-on: ubuntu-latest
1339
timeout-minutes: 120
1440

1541
steps:
16-
- uses: actions/checkout@v2
17-
18-
- uses: camptocamp/initialise-gopass-summon-action@v2
19-
with:
20-
ci-gpg-private-key: ${{secrets.CI_GPG_PRIVATE_KEY}}
21-
github-gopass-ci-token: ${{secrets.GOPASS_CI_GITHUB_TOKEN}}
22-
patterns: docker
23-
24-
- name: "Build images"
25-
env:
26-
PUSH_DOCKER_HUB: false
27-
PUSH_GHCR: false
28-
run: |
29-
make all
30-
- name: "Push images"
31-
env:
32-
PUSH_DOCKER_HUB: true
33-
PUSH_GHCR: true
34-
run: |
35-
make all
36-
if: github.ref == 'master'
42+
- name: Checkout code
43+
uses: actions/checkout@v2
44+
45+
- name: Build without pushing
46+
run: make

0 commit comments

Comments
 (0)