|
|
@@ -11,42 +11,19 @@ on:
|
|
|
required: false
|
|
|
|
|
|
jobs:
|
|
|
- build_single_arch:
|
|
|
- name: Build & push (${{ matrix.arch }}) [native]
|
|
|
- strategy:
|
|
|
- fail-fast: false
|
|
|
- matrix:
|
|
|
- include:
|
|
|
- - arch: amd64
|
|
|
- platform: linux/amd64
|
|
|
- runner: ubuntu-latest
|
|
|
- - arch: arm64
|
|
|
- platform: linux/arm64
|
|
|
- runner: ubuntu-24.04-arm
|
|
|
- runs-on: ${{ matrix.runner }}
|
|
|
+ push_to_registries:
|
|
|
+ name: Push Docker image to multiple registries
|
|
|
+ runs-on: ubuntu-latest
|
|
|
permissions:
|
|
|
packages: write
|
|
|
contents: read
|
|
|
steps:
|
|
|
- - name: Check out (shallow)
|
|
|
+ - name: Check out the repo
|
|
|
uses: actions/checkout@v4
|
|
|
- with:
|
|
|
- fetch-depth: 1
|
|
|
|
|
|
- - name: Determine alpha version
|
|
|
- id: version
|
|
|
+ - name: Save version info
|
|
|
run: |
|
|
|
- VERSION="alpha-$(date +'%Y%m%d')-$(git rev-parse --short HEAD)"
|
|
|
- echo "$VERSION" > VERSION
|
|
|
- echo "value=$VERSION" >> $GITHUB_OUTPUT
|
|
|
- echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
|
- echo "Publishing version: $VERSION for ${{ matrix.arch }}"
|
|
|
-
|
|
|
- - name: Normalize GHCR repository
|
|
|
- run: echo "GHCR_REPOSITORY=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
|
|
|
-
|
|
|
- - name: Set up Docker Buildx
|
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
+ echo "alpha-$(date +'%Y%m%d')-$(git rev-parse --short HEAD)" > VERSION
|
|
|
|
|
|
- name: Log in to Docker Hub
|
|
|
uses: docker/login-action@v3
|
|
|
@@ -54,98 +31,32 @@ jobs:
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
- - name: Log in to GHCR
|
|
|
+ - name: Log in to the Container registry
|
|
|
uses: docker/login-action@v3
|
|
|
with:
|
|
|
registry: ghcr.io
|
|
|
username: ${{ github.actor }}
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
- - name: Extract metadata (labels)
|
|
|
+ - name: Set up Docker Buildx
|
|
|
+ uses: docker/setup-buildx-action@v3
|
|
|
+
|
|
|
+ - name: Extract metadata (tags, labels) for Docker
|
|
|
id: meta
|
|
|
uses: docker/metadata-action@v5
|
|
|
with:
|
|
|
images: |
|
|
|
calciumion/new-api
|
|
|
- ghcr.io/${{ env.GHCR_REPOSITORY }}
|
|
|
+ ghcr.io/${{ github.repository }}
|
|
|
+ tags: |
|
|
|
+ type=raw,value=alpha
|
|
|
+ type=raw,value=alpha-{{date 'YYYYMMDD'}}-{{sha}}
|
|
|
|
|
|
- - name: Build & push single-arch (to both registries)
|
|
|
- uses: docker/build-push-action@v6
|
|
|
+ - name: Build and push Docker images
|
|
|
+ uses: docker/build-push-action@v5
|
|
|
with:
|
|
|
context: .
|
|
|
- platforms: ${{ matrix.platform }}
|
|
|
+ platforms: linux/amd64,linux/arm64
|
|
|
push: true
|
|
|
- tags: |
|
|
|
- calciumion/new-api:alpha-${{ matrix.arch }}
|
|
|
- calciumion/new-api:${{ steps.version.outputs.value }}-${{ matrix.arch }}
|
|
|
- ghcr.io/${{ env.GHCR_REPOSITORY }}:alpha-${{ matrix.arch }}
|
|
|
- ghcr.io/${{ env.GHCR_REPOSITORY }}:${{ steps.version.outputs.value }}-${{ matrix.arch }}
|
|
|
+ tags: ${{ steps.meta.outputs.tags }}
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
- cache-from: type=gha
|
|
|
- cache-to: type=gha,mode=max
|
|
|
- provenance: false
|
|
|
- sbom: false
|
|
|
-
|
|
|
- create_manifests:
|
|
|
- name: Create multi-arch manifests (Docker Hub + GHCR)
|
|
|
- needs: [build_single_arch]
|
|
|
- runs-on: ubuntu-latest
|
|
|
- permissions:
|
|
|
- packages: write
|
|
|
- contents: read
|
|
|
- steps:
|
|
|
- - name: Check out (shallow)
|
|
|
- uses: actions/checkout@v4
|
|
|
- with:
|
|
|
- fetch-depth: 1
|
|
|
-
|
|
|
- - name: Normalize GHCR repository
|
|
|
- run: echo "GHCR_REPOSITORY=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
|
|
|
-
|
|
|
- - name: Determine alpha version
|
|
|
- id: version
|
|
|
- run: |
|
|
|
- VERSION="alpha-$(date +'%Y%m%d')-$(git rev-parse --short HEAD)"
|
|
|
- echo "value=$VERSION" >> $GITHUB_OUTPUT
|
|
|
- echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
|
-
|
|
|
- - name: Log in to Docker Hub
|
|
|
- uses: docker/login-action@v3
|
|
|
- with:
|
|
|
- username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
- password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
-
|
|
|
- - name: Create & push manifest (Docker Hub - alpha)
|
|
|
- run: |
|
|
|
- docker buildx imagetools create \
|
|
|
- -t calciumion/new-api:alpha \
|
|
|
- calciumion/new-api:alpha-amd64 \
|
|
|
- calciumion/new-api:alpha-arm64
|
|
|
-
|
|
|
- - name: Create & push manifest (Docker Hub - versioned alpha)
|
|
|
- run: |
|
|
|
- docker buildx imagetools create \
|
|
|
- -t calciumion/new-api:${VERSION} \
|
|
|
- calciumion/new-api:${VERSION}-amd64 \
|
|
|
- calciumion/new-api:${VERSION}-arm64
|
|
|
-
|
|
|
- - name: Log in to GHCR
|
|
|
- uses: docker/login-action@v3
|
|
|
- with:
|
|
|
- registry: ghcr.io
|
|
|
- username: ${{ github.actor }}
|
|
|
- password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
-
|
|
|
- - name: Create & push manifest (GHCR - alpha)
|
|
|
- run: |
|
|
|
- docker buildx imagetools create \
|
|
|
- -t ghcr.io/${GHCR_REPOSITORY}:alpha \
|
|
|
- ghcr.io/${GHCR_REPOSITORY}:alpha-amd64 \
|
|
|
- ghcr.io/${GHCR_REPOSITORY}:alpha-arm64
|
|
|
-
|
|
|
- - name: Create & push manifest (GHCR - versioned alpha)
|
|
|
- run: |
|
|
|
- docker buildx imagetools create \
|
|
|
- -t ghcr.io/${GHCR_REPOSITORY}:${VERSION} \
|
|
|
- ghcr.io/${GHCR_REPOSITORY}:${VERSION}-amd64 \
|
|
|
- ghcr.io/${GHCR_REPOSITORY}:${VERSION}-arm64
|