fix: gcp service account name max 30char (#24) #133
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- "[0-9]+.[0-9]+.[0-9]+-*" | |
- "[0-9]+.[0-9]+.[0-9]+" | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Determine Build Information | |
id: buildinfo | |
run: | | |
target=linux/amd64 | |
case $GITHUB_REF in | |
*-arm64*) target=linux/arm64;; | |
esac | |
case $GITHUB_REF in | |
refs/tags/*) VERSION=${GITHUB_REF#refs/tags/};; | |
refs/heads/*) VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')-${GITHUB_SHA::7};; | |
refs/pull/*) VERSION=pr-${{ github.event.number }}-${GITHUB_SHA::7};; | |
*) VERSION=sha-${GITHUB_SHA::7};; | |
esac | |
echo "build_version=${VERSION}" >> $GITHUB_ENV | |
echo "build_target=${target}" >> $GITHUB_ENV | |
echo "build_gitref=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
echo "build_commit_date=$(git show -s --format=%cI)" >> $GITHUB_ENV | |
echo "build_date=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV | |
echo "build_image_repo=ghcr.io/${{ github.repository }}" >> $GITHUB_ENV | |
echo "build_image=ghcr.io/${{ github.repository }}:${VERSION}" >> $GITHUB_ENV | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker Login (GitHub) | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
#cache-from: type=local,src=/tmp/.buildx-cache | |
#cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | |
platforms: ${{ env.build_target }} | |
tags: ${{ env.build_image }} | |
build-args: | | |
APP_VERSION=${{ env.build_version }} | |
COMMIT_HASH=${{ github.sha }} | |
COMMIT_DATE=${{ env.build_commit_date }} | |
BUILD_DATE=${{ env.build_date }} | |
GIT_REF=${{ env.build_gitref }} | |
BUILD_BY=github-actions | |
labels: | | |
org.opencontainers.image.title=${{ github.event.repository.name }} | |
org.opencontainers.image.description=${{ github.event.repository.description }} | |
org.opencontainers.image.url=${{ github.event.repository.html_url }} | |
org.opencontainers.image.source=${{ github.event.repository.clone_url }} | |
org.opencontainers.image.version=${{ env.build_version }} | |
org.opencontainers.image.created=${{ env.build_date }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }} | |
org.opencontainers.image.documentation=https://identity-manager.io/ |