From 0fda9be55754fcc9918ad4a7870eba538377863b Mon Sep 17 00:00:00 2001 From: Julien Acroute Date: Thu, 17 Oct 2024 16:13:33 +0200 Subject: [PATCH] fix: ci --- .github/workflows/ci.yaml | 54 +++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1da9cb8..26c9080 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,35 +2,45 @@ name: Build PostgreSQL images on: + # trigger every sunday morning schedule: - cron: "2 2 * * SUN" + # trigger on PR merge and push to master branch push: + branches: + - master + # trigger on PR + pull_request: + branches: + - master jobs: - build: + build-and-push: + if: github.event_name == 'push' || github.event_name == 'schedule' + runs-on: ubuntu-latest + timeout-minutes: 120 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Log in to GitHub Container Registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Log in to Docker Hub + run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login docker.io -u dockerc2c --password-stdin + + - name: Build and push with Docker + run: make PUSH_DOCKER_HUB=true PUSH_GHCR=true + + build-on-pr: + if: github.event_name == 'pull_request' runs-on: ubuntu-latest timeout-minutes: 120 steps: - - uses: actions/checkout@v2 - - - uses: camptocamp/initialise-gopass-summon-action@v2 - with: - ci-gpg-private-key: ${{secrets.CI_GPG_PRIVATE_KEY}} - github-gopass-ci-token: ${{secrets.GOPASS_CI_GITHUB_TOKEN}} - patterns: docker - - - name: "Build images" - env: - PUSH_DOCKER_HUB: false - PUSH_GHCR: false - run: | - make all - - name: "Push images" - env: - PUSH_DOCKER_HUB: true - PUSH_GHCR: true - run: | - make all - if: github.ref == 'master' + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build without pushing + run: make