diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56731eb..9186943 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,33 +7,56 @@ on: - dev jobs: - checkout_repository: + build_and_push: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Test Gitea - run: | - echo "GITEA_Actor: ${{gitea.actor}}" - echo "GITEA_Repository: ${{gitea.repository}}" - echo "GITEA_REF_NAME: ${{gitea.ref_name}}" - echo "REGISTRY_USER: ${{secrets.registry_user}}" - - # KANIKO - - name: Kaniko build and push - uses: aevea/action-kaniko@master + - uses: azure/k8s-set-context@v4 + with: + method: kubeconfig + kubeconfig: ${{secrets.buildx_kubeconfig}} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: kubernetes + driver-opts: | + namespace=gitea + + - name: Login to Docker Registry + uses: docker/login-action@v3 with: - build_file: Dockerfile registry: git.coopgo.io - username: ${{secrets.registry_user}} - password: ${{secrets.registry_token}} - image: ${{gitea.repository}} - tag: ${{gitea.ref_name}} - cache: true - cache_registry: git.coopgo.io/${{gitea.repository}}/cache - extra-args: | + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + git.coopgo.io/${{gitea.repository}}:${{gitea.ref_name}} + build-args: | ACCESS_TOKEN_USR=${{gitea.actor}} ACCESS_TOKEN_PWD=${{gitea.token}} + + # BUILD WITH KANIKO + # - name: Kaniko build and push + # uses: aevea/action-kaniko@master + # with: + # build_file: Dockerfile + # registry: git.coopgo.io + # username: ${{secrets.registry_user}} + # password: ${{secrets.registry_token}} + # image: ${{gitea.repository}} + # tag: ${{gitea.ref_name}} + # cache: true + # cache_registry: git.coopgo.io/${{gitea.repository}}/cache + # extra-args: | + # ACCESS_TOKEN_USR=${{gitea.actor}} + # ACCESS_TOKEN_PWD=${{gitea.token}}