mirror of
https://github.com/XrayR-project/XrayR.git
synced 2025-07-05 10:39:50 +00:00
154 lines
4.7 KiB
YAML
154 lines
4.7 KiB
YAML
name: Publish Docker image
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- "**/*.go"
|
|
- "go.mod"
|
|
- "go.sum"
|
|
- ".github/workflows/*.yml"
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches:
|
|
- 'master'
|
|
jobs:
|
|
build-armv7-image:
|
|
name: Build armv7 Image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
platforms: linux/arm/v7
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}-armv7
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-arm64-image:
|
|
name: Build arm64 Image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
platforms: linux/arm64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}-arm64
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-amd64-image:
|
|
name: Build amd64 Image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}-amd64
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-s390x-image:
|
|
name: Build s390x Image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
platforms: linux/s390x
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}-s390x
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
combine-images:
|
|
name: Combine Images
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build-armv7-image
|
|
- build-arm64-image
|
|
- build-amd64-image
|
|
- build-s390x-image
|
|
steps:
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
- name: Combine images
|
|
run: |
|
|
docker manifest create ${{ steps.meta.outputs.tags }} \
|
|
--amend ${{ steps.meta.outputs.tags }}-armv7 \
|
|
--amend ${{ steps.meta.outputs.tags }}-arm64 \
|
|
--amend ${{ steps.meta.outputs.tags }}-amd64 \
|
|
--amend ${{ steps.meta.outputs.tags }}-s390x
|
|
docker manifest push ${{ steps.meta.outputs.tags }}
|