Browse Source

ci: make unified manual container build release-tag based

pull/8290/head
Chris Lu 17 hours ago
parent
commit
cbb97165ce
  1. 76
      .github/workflows/container_release_unified.yml

76
.github/workflows/container_release_unified.yml

@ -13,12 +13,15 @@ on:
default: all default: all
options: options:
- all - all
- dev
- normal - normal
- large_disk - large_disk
- full - full
- large_disk_full - large_disk_full
- rocksdb - rocksdb
release_tag:
description: 'Release tag to publish (e.g. 3.93)'
required: true
default: ''
rocksdb_version: rocksdb_version:
description: 'RocksDB git tag to use when variant=rocksdb' description: 'RocksDB git tag to use when variant=rocksdb'
required: false required: false
@ -27,71 +30,15 @@ on:
permissions: permissions:
contents: read contents: read
env:
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag || github.ref_name }}
# Limit concurrent builds to avoid rate limits # Limit concurrent builds to avoid rate limits
concurrency: concurrency:
group: release-${{ github.ref }} group: release-${{ github.ref }}
cancel-in-progress: false cancel-in-progress: false
jobs: jobs:
build-dev-on-demand:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.variant == 'dev'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: |
chrislusf/seaweedfs
ghcr.io/chrislusf/seaweedfs
tags: |
type=raw,value=dev
labels: |
org.opencontainers.image.title=seaweedfs
org.opencontainers.image.description=SeaweedFS is a distributed storage system for blobs, objects, files, and data lake, to store and serve billions of files fast!
org.opencontainers.image.vendor=Chris Lu
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Create BuildKit config
run: |
cat > /tmp/buildkitd.toml <<EOF
[registry."docker.io"]
mirrors = ["https://mirror.gcr.io"]
EOF
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-config: /tmp/buildkitd.toml
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push dev
uses: docker/build-push-action@v6
with:
context: ./docker
push: true
file: ./docker/Dockerfile.go_build
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: | if: |
@ -162,7 +109,7 @@ jobs:
images: | images: |
chrislusf/seaweedfs chrislusf/seaweedfs
ghcr.io/chrislusf/seaweedfs ghcr.io/chrislusf/seaweedfs
tags: type=ref,event=tag,suffix=${{ matrix.tag_suffix }}
tags: type=raw,value=${{ env.RELEASE_TAG }}${{ matrix.tag_suffix }}
flavor: latest=false flavor: latest=false
labels: | labels: |
org.opencontainers.image.title=seaweedfs org.opencontainers.image.title=seaweedfs
@ -211,7 +158,7 @@ jobs:
platforms: ${{ matrix.platforms }} platforms: ${{ matrix.platforms }}
# Push to GHCR to avoid Docker Hub rate limits on pulls # Push to GHCR to avoid Docker Hub rate limits on pulls
tags: | tags: |
ghcr.io/chrislusf/seaweedfs:${{ github.ref_name }}${{ matrix.tag_suffix }}
ghcr.io/chrislusf/seaweedfs:${{ env.RELEASE_TAG }}${{ matrix.tag_suffix }}
labels: ${{ steps.docker_meta.outputs.labels }} labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.variant }} cache-from: type=gha,scope=${{ matrix.variant }}
cache-to: type=gha,mode=max,scope=${{ matrix.variant }} cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
@ -306,8 +253,8 @@ jobs:
# This is much more efficient than pulling/pushing individual arch images # This is much more efficient than pulling/pushing individual arch images
echo "Copying ${{ matrix.variant }} from GHCR to Docker Hub..." echo "Copying ${{ matrix.variant }} from GHCR to Docker Hub..."
retry_with_backoff crane copy \ retry_with_backoff crane copy \
ghcr.io/chrislusf/seaweedfs:${{ github.ref_name }}${{ matrix.tag_suffix }} \
chrislusf/seaweedfs:${{ github.ref_name }}${{ matrix.tag_suffix }}
ghcr.io/chrislusf/seaweedfs:${{ env.RELEASE_TAG }}${{ matrix.tag_suffix }} \
chrislusf/seaweedfs:${{ env.RELEASE_TAG }}${{ matrix.tag_suffix }}
echo "✓ Successfully copied ${{ matrix.variant }} to Docker Hub" echo "✓ Successfully copied ${{ matrix.variant }} to Docker Hub"
@ -328,4 +275,3 @@ jobs:
target_dir: helm target_dir: helm
branch: gh-pages branch: gh-pages
helm_version: "3.18.4" helm_version: "3.18.4"
Loading…
Cancel
Save