Skip to content

Commit 571a6a0

Browse files
committed
feat: add push to GHCR
1 parent a33d9a7 commit 571a6a0

1 file changed

Lines changed: 48 additions & 46 deletions

File tree

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

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,54 @@ jobs:
3030
cd user-management/tests/Stickerlandia.UserManagement.UnitTest
3131
dotnet test
3232
33+
34+
push-image:
35+
runs-on: ubuntu-latest
36+
# needs: [integration-test-azure, integration-test-agnostic]
37+
steps:
38+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
- name: Get Commit Info
40+
id: get_sha
41+
run: |
42+
echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
43+
echo "COMMIT_SHA_FULL=$(git rev-parse HEAD)" >> $GITHUB_ENV
44+
45+
-
46+
name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@v3
48+
49+
- name: Log in to the Container registry
50+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
51+
with:
52+
registry: ${{ env.REGISTRY }}
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Extract metadata (tags, labels) for Docker
57+
id: meta
58+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
59+
with:
60+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_USER_SERVICE }}
61+
tags: |
62+
latest
63+
${{ env.COMMIT_SHA }}
64+
${{ env.COMMIT_SHA_FULL }}
65+
66+
- name: Build and push Docker image
67+
id: push
68+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
69+
with:
70+
context: ./user-management
71+
file: ./src/Stickerlandia.UserManagement.Api/Dockerfile
72+
platforms: linux/amd64,linux/arm64
73+
push: true
74+
tags: ${{ steps.meta.outputs.tags }}
75+
labels: ${{ steps.meta.outputs.labels }}
76+
build-args: |
77+
GIT_COMMIT_SHA=${{ env.COMMIT_SHA_FULL }}
78+
GIT_REPOSITORY_URL=${{ env.REPOSITORY_URL }}
79+
80+
3381
integration-test-azure:
3482
runs-on: ubuntu-latest
3583
needs: unit-test
@@ -120,49 +168,3 @@ jobs:
120168
DRIVEN: AGNOSTIC
121169
run: |
122170
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)