Skip to content

Sync version to 17.7.0 (#155) #260

Sync version to 17.7.0 (#155)

Sync version to 17.7.0 (#155) #260

Workflow file for this run

name: build
on:
push:
paths-ignore:
- README*.md
- LICENSE
- .editorconfig
- .gitignore
- .github/workflows/syncver.yml
branches-ignore:
# The syncver** branches will be triggered in the pull request,
# so there is no need to trigger it when pushing.
- syncver**
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- RELEASE_PACKAGE: gitlab-ce
RELEASE_VERSION: 17.7.0-ce.0
PUSH_TAGS: 17.7.0-ce.0,17.7.0-ce,17.7-ce,17-ce,ce,latest
- RELEASE_PACKAGE: gitlab-ee
RELEASE_VERSION: 17.7.0-ee.0
PUSH_TAGS: 17.7.0-ee.0,17.7.0-ee,17.7-ee,17-ee,ee
steps:
- uses: actions/checkout@v3
- name: docker login to docker.io
uses: docker/login-action@v2
# Only builds on the main branch will trigger the push, and forked repositories are excluded
if: github.repository_owner == 'zengxs' && github.ref == 'refs/heads/main'
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup binfmt-support
uses: docker/setup-qemu-action@v2
- name: Setup docker buildx
uses: docker/setup-buildx-action@v2
# Generate the push tags for multi-arch manifest
- name: Generate tags
id: generate-tags
run: |
push_tags=$(echo ${{ matrix.PUSH_TAGS }} | tr ',' '\n' | xargs -I {} echo "docker.io/${{ secrets.DOCKERHUB_USERNAME }}/gitlab:{}" | tr '\n' ',')
echo "push_tags=${push_tags}" >> $GITHUB_ENV
# Generate the push tags for arm64 image (add '-arm64' suffix to the push tags)
- name: Generate ARM64 tags
id: generate-arm64-tags
run: |
push_arm64_tags=$(echo ${{ env.push_tags }} | tr ',' '\n' | xargs -I {} echo "{}-arm64" | tr '\n' ',')
echo "push_arm64_tags=${push_arm64_tags}" >> $GITHUB_ENV
- name: Build and push ARM64 image
uses: docker/build-push-action@v3
with:
context: .
# Only builds on the main branch will trigger the push, and forked repositories are excluded
push: ${{ github.repository_owner == 'zengxs' && github.ref == 'refs/heads/main' }}
tags: ${{ env.push_arm64_tags }}
platforms: linux/arm64
# Disable provenance generation to resolve issue #82
provenance: false
build-args: |
RELEASE_PACKAGE=${{ matrix.RELEASE_PACKAGE }}
RELEASE_VERSION=${{ matrix.RELEASE_VERSION }}
TARGETARCH=arm64
# Create multi-arch manifest (x86-64 reuses official image, arm64 uses the image built in the previous step)
- name: Docker multi-arch manifest
# Only builds on the main branch will trigger the push, and forked repositories are excluded
if: github.repository_owner == 'zengxs' && github.ref == 'refs/heads/main'
shell: python
env:
RELEASE_PACKAGE: ${{ matrix.RELEASE_PACKAGE }}
RELEASE_VERSION: ${{ matrix.RELEASE_VERSION }}
run: |
import os
import sys
RELEASE_PACKAGE = os.environ['RELEASE_PACKAGE']
RELEASE_VERSION = os.environ['RELEASE_VERSION']
push_tags = os.environ['push_tags'].split(',')
push_tags = [tag for tag in push_tags if tag != '']
def run_command(cmd):
print(f'RUN: {cmd}')
ret_code = os.system(cmd)
if ret_code != 0:
print(f"command failed: {cmd}")
sys.exit(ret_code)
for tag in push_tags:
print(f'Creating multi-arch manifest for {tag}')
run_command(f'docker manifest create {tag} --amend {tag}-arm64 --amend docker.io/gitlab/{RELEASE_PACKAGE}:{RELEASE_VERSION}')
run_command(f'docker manifest push --purge {tag}')