mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-31 08:22:33 +00:00
70 lines
1.9 KiB
YAML
70 lines
1.9 KiB
YAML
name: deploy-docker-image
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "master"
|
|
|
|
jobs:
|
|
docker-build-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
attestations: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Check Repository
|
|
run: |
|
|
if [ "${{ github.repository }}" != "Pumpkin-MC/Pumpkin" ]; then
|
|
echo "Not the target repository. Exiting successfully."
|
|
exit 0
|
|
fi
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to GitHub CR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract Versions
|
|
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
|
|
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
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and Push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
annotations: ${{ steps.meta.outputs.annotations }}
|