Merge pull request #7 from LynBean/dependabot/maven/dev.lavalink.yout… #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
branches: | |
- "master" | |
- "feature/docker" | |
- "translation/chinese" | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get Repository Name | |
id: repo_name | |
run: | | |
echo "name=ghcr.io/${{ github.repository }}" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT | |
- name: Get Docker Tag | |
id: docker_tag | |
run: | | |
if [[ "${GITHUB_REF}" == refs/heads/*/* ]]; then | |
echo "tag=$(echo ${GITHUB_REF} | awk -F/ '{print $NF}')" >> $GITHUB_OUTPUT | |
else | |
echo "tag=$(echo ${GITHUB_REF} | sed 's/refs\/heads\///')" >> $GITHUB_OUTPUT | |
fi | |
- name: Docker Setup Qemu | |
uses: docker/setup-qemu-action@v3 | |
- name: Docker Setup Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker Login | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Docker Cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ steps.repo_name.outputs.name }} | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }} | |
type=raw,value= ${{ steps.docker_tag.outputs.tag }},enable=${{ startsWith(github.ref, 'refs/heads/') }} | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=sha | |
- name: Docker Build and Push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: | | |
linux/amd64, | |
linux/arm64 | |
cache-from: | | |
type=local,src=/tmp/.buildx-cache | |
cache-to: | | |
type=local,dest=/tmp/.buildx-cache |