Files
Pumpkin/.github/workflows/docker.yml
dependabot[bot] 2e4ffa96ba build(deps): bump actions/checkout from 5 to 6 (#1218)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-25 10:41:44 +01:00

81 lines
2.4 KiB
YAML

name: deploy-docker-image
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
on:
push:
branches:
- "master"
workflow_dispatch:
jobs:
docker-build-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Check Repository
id: repo_check
run: |
if [ "${{ github.repository }}" != "Pumpkin-MC/Pumpkin" ]; then
echo "Not the target repository. Skipping deployment."
echo "should_deploy=false" >> $GITHUB_OUTPUT
else
echo "Target repository confirmed. Proceeding with deployment."
echo "should_deploy=true" >> $GITHUB_OUTPUT
fi
- name: Checkout
if: steps.repo_check.outputs.should_deploy == 'true'
uses: actions/checkout@v6
- name: Login to GitHub CR
if: steps.repo_check.outputs.should_deploy == 'true'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Versions
if: steps.repo_check.outputs.should_deploy == 'true'
id: versions
run: |
VERSION=$(awk -F '"' '/^version/ {print $2}' Cargo.toml)
echo "PUMPKIN_VERSION=$(echo $VERSION | cut -d '+' -f 1)" >> $GITHUB_ENV
echo "MC_VERSION=$(echo $VERSION | cut -d '+' -f 2)" >> $GITHUB_ENV
- name: Extract Metadata
if: steps.repo_check.outputs.should_deploy == 'true'
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=raw,value=latest
type=sha
type=raw,value=mc${{ env.MC_VERSION }}
type=raw,value=${{ env.PUMPKIN_VERSION }}
type=raw,value=mc${{ env.MC_VERSION }}-${{ env.PUMPKIN_VERSION }}
- name: Docker Buildx
if: steps.repo_check.outputs.should_deploy == 'true'
uses: docker/setup-buildx-action@v3
- name: Build and Push
if: steps.repo_check.outputs.should_deploy == 'true'
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}