name: Docker image CD on: push: tags: - '*.*.*' branches: - 'main' pull_request: branches: - 'main' workflow_dispatch: jobs: build_and_push: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Get Meta id: meta run: | echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v2 # - name: Log in to Gitea Docker Registry # run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login https://gitea.suda.codes -u ${{ secrets.DOCKER_USERNAME }} --password-stdin - name: Login to DockerHub if: github.event_name != 'pull_request' uses: docker/login-action@v2 with: registry: gitea.suda.codes username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_ACCESS_TOKEN }} - name: Build and push uses: docker/build-push-action@v3 with: context: . # platforms: linux/amd64,linux/arm/v7,linux/arm64 platforms: linux/amd64 push: ${{ github.event_name != 'pull_request' }} tags: | gitea.suda.codes/sudacode/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }} gitea.suda.codes/sudacode/${{ steps.meta.outputs.REPO_NAME }}:latest