name: Build and Publish Container Image on: push: branches: - main tags: - "v*" env: # The deployed image is forgejo.coulomb.social/coulomb/key-cape (recorded in # KEY-WP-0013). This previously read 92.205.130.254:32166, so the tag a push # produced and the tag the cluster ran were not obviously the same artifact # (KEY-WP-0026). Overridable via a repository variable if the runner needs the # address rather than the name. REGISTRY: ${{ vars.REGISTRY || 'forgejo.coulomb.social' }} IMAGE_NAME: coulomb/key-cape jobs: build-and-push: runs-on: act_runner steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Gitea registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_TOKEN }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=latest,enable={{is_default_branch}} type=sha,prefix=main-,format=short,enable={{is_default_branch}} type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - name: Build and push uses: docker/build-push-action@v5 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max