1
0
Fork 1
mirror of https://github.com/0x2E/fusion.git synced 2025-06-09 09:34:58 +09:00
fusion/.github/workflows/docker.yml
2025-05-01 00:04:45 +08:00

58 lines
1.8 KiB
YAML

name: docker
on:
release:
types: [published]
push:
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # for vite extracting git tag/hash
- name: Lowercase Owner and Repository Name
run: echo "REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
rook1e404/fusion
ghcr.io/${{ env.REPOSITORY }}
tags: |
# on release: tag with version (e.g., v1.2.3)
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }}
# on push to main: tag with main
type=raw,value=main,enable=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: amd64,arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}