Skip to content

Commit

Permalink
ci: fix docker labels (#6978)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Oct 30, 2023
1 parent 452f59f commit add8f9d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- chandler

workflow_dispatch:

Expand All @@ -31,10 +30,15 @@ jobs:

- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v5
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.package-name }}
tag-sha: true
tags: |
type=sha
labels: |
org.opencontainers.image.description="This is MonicaHQ, your personal memory! MonicaHQ is like a CRM but for the friends, family, and acquaintances around you."
org.opencontainers.image.title="MonicaHQ, the Personal Relationship Manager"
org.opencontainers.image.vendor="Monica"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -50,6 +54,10 @@ jobs:
- name: Configure variables
run: scripts/docker/build.sh --skip-build $GITHUB_SHA

- name: Fix labels
id: labels
run: scripts/ci/labels.sh labels "${{ steps.docker_meta.outputs.labels }}"

# Build docker
- name: Docker build
id: docker_build
Expand All @@ -62,6 +70,7 @@ jobs:
file: scripts/docker/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
outputs: ${{ steps.labels.outputs.labels }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- chandler

jobs:
build:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ matrix.php-version }}
${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ env.php-version }}
${{ runner.os }}-composer-
# Yarn
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
node-version: ${{ env.build-node-version }}
- name: Cache yarn files
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -159,4 +159,5 @@ jobs:
with:
workflow: Release update
repo: monicahq/docker
ref: refs/heads/main
token: ${{ secrets.DOCKER_GITHUB_TOKEN }}
12 changes: 1 addition & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- chandler
pull_request:
types: [opened, synchronize, reopened]
release:
Expand Down Expand Up @@ -181,15 +180,6 @@ jobs:
SONAR_COVERAGE=$(ls -m --format=comma results/${{ env.coverage-with }}/coverage/coverage*.xml | sed -e ':a;N;$!ba;s/\n//g; s/ //g;')
echo "list=$SONAR_COVERAGE" >> $GITHUB_OUTPUT
- name: Set project key
id: projectkey
run: |
if [[ "${{ github.repository }}" == "monicahq/chandler" ]]; then
echo "value=monicahq_chandler" >> $GITHUB_OUTPUT
elif [[ "${{ github.repository }}" == "monicahq/monica" ]]; then
echo "value=monica" >> $GITHUB_OUTPUT
fi
- name: SonarCloud Scan
if: env.SONAR_TOKEN != ''
uses: SonarSource/[email protected]
Expand All @@ -198,7 +188,7 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: |
-Dsonar.projectKey=${{ steps.projectkey.outputs.value }}
-Dsonar.projectKey=monica
-Dsonar.organization=monicahq
-Dsonar.sources=app,bootstrap,config,database,public,resources,routes
-Dsonar.exclusions=bootstrap/cache/*,public/vendor/**,resources/lang/**
Expand Down
15 changes: 15 additions & 0 deletions scripts/ci/labels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
set -ex

IFS='
'
variable=$1
labels=$2

{
echo "$variable<<EOF"
for label in $labels; do
echo type=image,name=target,annotation-index.$label
done
echo 'EOF'
} >> "$GITHUB_OUTPUT"

0 comments on commit add8f9d

Please sign in to comment.