enable build
This commit is contained in:
@@ -1,5 +1,23 @@
|
|||||||
name: Build & Push Docker image
|
name: Build & Push Docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
platform:
|
||||||
|
description: '构建平台 (留空则构建所有平台)'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
type: string
|
||||||
|
tag:
|
||||||
|
description: 'Docker 标签'
|
||||||
|
required: false
|
||||||
|
default: 'latest'
|
||||||
|
type: string
|
||||||
|
push:
|
||||||
|
branches: [ main, master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main, master ]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -18,6 +36,10 @@ jobs:
|
|||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- platform: linux/arm64
|
- platform: linux/arm64
|
||||||
os: ubuntu-24.04-arm
|
os: ubuntu-24.04-arm
|
||||||
|
# 如果手动触发时指定了平台,则只构建该平台
|
||||||
|
exclude:
|
||||||
|
- platform: ${{ github.event.inputs.platform != '' && matrix.platform != github.event.inputs.platform && 'linux/amd64' || '' }}
|
||||||
|
- platform: ${{ github.event.inputs.platform != '' && matrix.platform != github.event.inputs.platform && 'linux/arm64' || '' }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -47,9 +69,9 @@ jobs:
|
|||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
|
|
||||||
with:
|
with:
|
||||||
images: ghcr.io/${{ steps.lowercase.outputs.owner }}/moontv
|
images: ghcr.io/moontechlab/lunatv
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
type=raw,value=${{ github.event.inputs.tag || 'latest' }},enable={{is_default_branch}}
|
||||||
|
|
||||||
- name: Build and push by digest
|
- name: Build and push by digest
|
||||||
id: build
|
id: build
|
||||||
@@ -59,8 +81,8 @@ jobs:
|
|||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: ${{ matrix.platform }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
tags: ghcr.io/${{ steps.lowercase.outputs.owner }}/moontv:latest
|
tags: ghcr.io/moontechlab/lunatv:${{ github.event.inputs.tag || 'latest' }}
|
||||||
outputs: type=image,name=ghcr.io/${{ steps.lowercase.outputs.owner }}/moontv,name-canonical=true,push=true
|
outputs: type=image,name=ghcr.io/moontechlab/lunatv,name-canonical=true,push=true
|
||||||
|
|
||||||
- name: Export digest
|
- name: Export digest
|
||||||
run: |
|
run: |
|
||||||
@@ -105,8 +127,8 @@ jobs:
|
|||||||
- name: Create manifest list and push
|
- name: Create manifest list and push
|
||||||
working-directory: /tmp/digests
|
working-directory: /tmp/digests
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools create -t ghcr.io/${{ steps.lowercase.outputs.owner }}/moontv:latest \
|
docker buildx imagetools create -t ghcr.io/moontechlab/lunatv:${{ github.event.inputs.tag || 'latest' }} \
|
||||||
$(printf 'ghcr.io/${{ steps.lowercase.outputs.owner }}/moontv@sha256:%s ' *)
|
$(printf 'ghcr.io/moontechlab/lunatv@sha256:%s ' *)
|
||||||
|
|
||||||
cleanup-refresh:
|
cleanup-refresh:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
Reference in New Issue
Block a user