chore(misc): refine license header and file (#384) #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2023 Anass Bouassaba, Piotr Łoboda. | |
# | |
# Use of this software is governed by the Business Source License | |
# included in the file LICENSE in the root of this repository. | |
# | |
# As of the Change Date specified in that file, in accordance with | |
# the Business Source License, use of this software will be governed | |
# by the GNU Affero General Public License v3.0 only, included in the file | |
# AGPL-3.0-only in the root of this repository. | |
name: Build and Push voltaserve/idp | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- "idp/**" | |
- "!idp/.gitattributes" | |
- "!idp/.gitignore" | |
- "!idp/README.md" | |
- "!idp/.env" | |
tags: | |
- 'v*' | |
env: | |
IMAGE: voltaserve/idp | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [ "arm64", "amd64" ] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set Up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ matrix.platform }} | |
- name: Set Up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.IMAGE }} | |
tags: | | |
type=ref,event=branch,enable=${{ github.ref_type != 'tag' }} | |
type=ref,event=tag | |
type=sha,enable=${{ github.ref_type != 'tag' }} | |
type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }} | |
type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }} | |
type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }} | |
- name: Build and Push Docker Image | |
id: build | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./idp | |
platforms: ${{ matrix.platform }} | |
labels: ${{ steps.meta.outputs.labels }} | |
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true | |
- name: Export digest | |
run: | | |
mkdir -p /tmp/digests | |
digest="${{ steps.build.outputs.digest }}" | |
touch "/tmp/digests/${digest#sha256:}" | |
- name: Upload digest | |
uses: actions/upload-artifact@v4 | |
with: | |
name: digests-${{ matrix.platform }} | |
path: /tmp/digests/* | |
if-no-files-found: error | |
retention-days: 1 | |
merge: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- name: Download digests | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/digests | |
pattern: digests-* | |
merge-multiple: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.IMAGE }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Create manifest list and push | |
working-directory: /tmp/digests | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
$(printf '${{ env.IMAGE }}@sha256:%s ' *) |