diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml index 1b104bb..eb80d40 100644 --- a/.gitea/workflows/cd.yaml +++ b/.gitea/workflows/cd.yaml @@ -10,48 +10,15 @@ on: - "**/*.go" - "Dockerfile" - "Makefile" + pull_request: + branches: + - main workflow_dispatch: env: DOCKER_REGISTRY: gitea.t000-n.de jobs: - build_and_push: - name: Build and push - strategy: - matrix: - arch: [amd64] - runs-on: - - ubuntu-latest - - linux_${{ matrix.arch }} - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 - - name: Login to Registry - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ${{ env.DOCKER_REGISTRY }} - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Get Metadata - id: meta - run: | - echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT - echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT - - name: Build and push - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 - with: - context: . - file: ./Dockerfile - platforms: linux/${{ matrix.arch }} - push: true - provenance: false - build-args: GOARCH=${{ matrix.arch }} - tags: | - ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-${{ matrix.arch }} - create_tag: name: Create tag runs-on: ubuntu-latest @@ -73,32 +40,12 @@ jobs: run: | echo "tag=${{ steps.tag.outputs.new-tag }}" >> $GITHUB_OUTPUT - create_manifest: - name: Create manifest - needs: - - build_and_push - - create_tag - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Get Metadata - id: meta - run: | - echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT - echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT - - - name: Login to Registry - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ${{ env.DOCKER_REGISTRY }} - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - - name: Create manifest - run: | - docker manifest create ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ needs.create_tag.outputs.tag }} \ - ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-amd64 - - docker manifest push ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ needs.create_tag.outputs.tag }} + build_and_push_image: + needs: create_tag + uses: https://gitea.t000-n.de/t.behrendt/gitea-actions/.gitea/workflows/build-container.yaml + with: + registry: gitea.t000-n.de/t.behrendt + registry-user: ${{ secrets.REGISTRY_USER }} + registry-password: ${{ secrets.REGISTRY_PASSWORD }} + repo-name: authentik-kubernetes-operator + tag: ${{ needs.create_tag.outputs.tag }}