Skip to content

Commit a33d9a7

Browse files
committed
feat: add push to GHCR
1 parent 4b5ded7 commit a33d9a7

1 file changed

Lines changed: 52 additions & 1 deletion

File tree

.github/workflows/user-management-test.yml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
- "user-management/**"
1212
workflow_dispatch:
1313

14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME_USER_SERVICE: ${{ github.repository_owner }}/stickerlandia/user-management-service
17+
REPOSITORY_URL: github.com/${{ github.repository }}
18+
1419
jobs:
1520
unit-test:
1621
runs-on: ubuntu-latest
@@ -114,4 +119,50 @@ jobs:
114119
DRIVING: ${{ matrix.DRIVING }}
115120
DRIVEN: AGNOSTIC
116121
run: |
117-
cd user-management/tests/Stickerlandia.UserManagement.IntegrationTest && dotnet test --logger:"console;verbosity=detailed"
122+
cd user-management/tests/Stickerlandia.UserManagement.IntegrationTest && dotnet test --logger:"console;verbosity=detailed"
123+
124+
push-image:
125+
runs-on: ubuntu-latest
126+
needs: [integration-test-azure, integration-test-agnostic]
127+
steps:
128+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
129+
- name: Get Commit Info
130+
id: get_sha
131+
run: |
132+
echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
133+
echo "COMMIT_SHA_FULL=$(git rev-parse HEAD)" >> $GITHUB_ENV
134+
135+
# Run container build
136+
-
137+
name: Set up Docker Buildx
138+
uses: docker/setup-buildx-action@v3
139+
140+
- name: Log in to the Container registry
141+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
142+
with:
143+
registry: ${{ env.REGISTRY }}
144+
username: ${{ github.actor }}
145+
password: ${{ secrets.GITHUB_TOKEN }}
146+
147+
- name: Extract metadata (tags, labels) for Docker
148+
id: meta
149+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
150+
with:
151+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_USER_SERVICE }}
152+
tags: |
153+
latest
154+
${{ env.COMMIT_SHA }}
155+
${{ env.COMMIT_SHA_FULL }}
156+
157+
- name: Build and push Docker image
158+
id: push
159+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
160+
with:
161+
context: apps/pass-api
162+
platforms: linux/amd64,linux/arm64
163+
push: true
164+
tags: ${{ steps.meta.outputs.tags }}
165+
labels: ${{ steps.meta.outputs.labels }}
166+
build-args: |
167+
GIT_COMMIT_SHA=${{ env.COMMIT_SHA_FULL }}
168+
GIT_REPOSITORY_URL=${{ env.REPOSITORY_URL }}

0 commit comments

Comments
 (0)