summaryrefslogtreecommitdiff
path: root/.gitea/workflows/gentoo-utils.yml
blob: 9e9cf6f6e61bb1429590f954009087f38a2a9ec1 (plain)
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
name: Gentoo Utils

on: [push]

defaults:
  run:
    shell: bash -l {0}

jobs:
  build-oci-image:
    runs-on: ubuntu-latest
    continue-on-error: true
    steps:
      - name: Checkout repo
        uses: actions/checkout@v5
        with:
          fetch-depth: 0

      - name: Check for changes before building
        id: image-changes
        run: |
          echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITEA_OUTPUT
          if ! git diff ${{ gitea.event.before }} ${{ gitea.sha }} --no-patch --exit-code .docker; then
            echo changes_detected=true >> $GITEA_OUTPUT
          else
            echo changes_detected=false >> $GITEA_OUTPUT
          fi
          cat $GITEA_OUTPUT
      - name: Set up Docker buildx
        if: steps.image-changes.outputs.changes_detected == 'true'
        uses: docker/setup-buildx-action@v3

      - name: Log in to Github Container Registry
        if: steps.image-changes.outputs.changes_detected == 'true'
        uses: docker/login-action@v3
        with:
          registry: git.epenguin.net
          username: ${{ vars.CI_BOT_USERNAME }}
          password: ${{ secrets.CI_BOT_TOKEN }}

      - name: Build and push
        if: steps.image-changes.outputs.changes_detected == 'true'
        uses: docker/build-push-action@v6
        with:
          push: true
          tags: git.epenguin.net/${{ gitea.repository }}:latest
          context: "{{defaultContext}}:.docker"

  build:
    runs-on: brutalisk
    container:
      image: git.epenguin.net/gentoo-utils/gentoo-utils-gitea:latest
    needs: build-oci-image
    steps:
      - name: Checkout repo
        uses: actions/checkout@v5

      - name: build and check
        run: ./check.sh