mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 12:42:27 +08:00
ci:docker tags
This commit is contained in:
parent
c504985b99
commit
bd43eca09d
65
.github/workflows/build.yml
vendored
65
.github/workflows/build.yml
vendored
@ -18,7 +18,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- Alpha
|
- Alpha
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@ -270,7 +270,7 @@ jobs:
|
|||||||
- name: Archive production artifacts
|
- name: Archive production artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.jobs.goos }}-${{ matrix.jobs.output }}
|
name: "${{ matrix.jobs.goos }}-${{ matrix.jobs.output }}"
|
||||||
path: |
|
path: |
|
||||||
mihomo*.gz
|
mihomo*.gz
|
||||||
mihomo*.deb
|
mihomo*.deb
|
||||||
@ -415,35 +415,35 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
|
|
||||||
- name: Set Docker tags and labels based on trigger
|
|
||||||
id: set-meta
|
|
||||||
run: |
|
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
||||||
echo "tags=${{ github.event.inputs.version }}" >> $GITHUB_ENV
|
|
||||||
echo "labels=org.opencontainers.image.version=${{ github.event.inputs.version }}" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "tags=${{ steps.meta.outputs.tags }}" >> $GITHUB_ENV
|
|
||||||
echo "labels=${{ steps.meta.outputs.labels }}" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Extract metadata (tags, labels) for Docker
|
# Extract metadata (tags, labels) for Docker
|
||||||
# https://github.com/docker/metadata-action
|
# https://github.com/docker/metadata-action
|
||||||
- name: Extract Docker metadata
|
- name: Extract Docker metadata
|
||||||
id: meta
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||||
|
id: meta_alpha
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ github.repository }}
|
images: '${{ env.REGISTRY }}/${{ github.repository }}'
|
||||||
tags: ${{ env.tags }}
|
|
||||||
labels: ${{ env.labels }}
|
# Extract metadata (tags, labels) for Docker
|
||||||
|
# https://github.com/docker/metadata-action
|
||||||
|
- name: Extract Docker metadata
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }}
|
||||||
|
id: meta_release
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: '${{ env.REGISTRY }}/${{ github.repository }}'
|
||||||
|
tags: |
|
||||||
|
${{ github.event.inputs.version }}
|
||||||
|
flavor: |
|
||||||
|
latest=true
|
||||||
|
labels: org.opencontainers.image.version=${{ github.event.inputs.version }}
|
||||||
|
|
||||||
- name: Show files
|
- name: Show files
|
||||||
run: |
|
run: |
|
||||||
ls .
|
ls .
|
||||||
ls bin/
|
ls bin/
|
||||||
|
|
||||||
- name: login to docker REGISTRY
|
- name: login to docker REGISTRY
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@ -454,7 +454,7 @@ jobs:
|
|||||||
# Build and push Docker image with Buildx (don't push on PR)
|
# Build and push Docker image with Buildx (don't push on PR)
|
||||||
# https://github.com/docker/build-push-action
|
# https://github.com/docker/build-push-action
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: build-and-push
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@ -465,5 +465,20 @@ jobs:
|
|||||||
linux/amd64
|
linux/amd64
|
||||||
linux/arm64
|
linux/arm64
|
||||||
linux/arm/v7
|
linux/arm/v7
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta_alpha.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta_alpha.outputs.labels }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }}
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
platforms: |
|
||||||
|
linux/386
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
||||||
|
linux/arm/v7
|
||||||
|
tags: ${{ steps.meta_release.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta_release.outputs.labels }}
|
Loading…
Reference in New Issue
Block a user