Skip to content

Commit a3489fc

Browse files
authored
Merge pull request #2 from ls1intum/chore/use-docker-workflow
`Development`: Use reusable github docker workflow
2 parents 7b73ef9 + 10656db commit a3489fc

File tree

1 file changed

+10
-68
lines changed

1 file changed

+10
-68
lines changed

.github/workflows/build-push-test.yml

Lines changed: 10 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -12,77 +12,19 @@ on:
1212
- created
1313

1414
jobs:
15-
buildx:
15+
build:
1616
name: Build and Push the Docker Images
17-
runs-on: ubuntu-latest
18-
steps:
19-
- name: Compute Tag
20-
uses: actions/github-script@v6
21-
id: compute-tag
22-
with:
23-
result-encoding: string
24-
script: |
25-
if (context.eventName === "pull_request") {
26-
return "pr-" + context.issue.number;
27-
}
28-
if (context.eventName === "push") {
29-
if (context.ref.startsWith("refs/tags/")) {
30-
return context.ref.slice(10);
31-
}
32-
if (context.ref === "refs/heads/main") {
33-
return "latest";
34-
}
35-
}
36-
return "FALSE";
37-
38-
- uses: actions/checkout@v2
39-
40-
-
41-
name: Docker Login
42-
id: docker-login
43-
run: |
44-
docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}}
45-
46-
-
47-
name: Login to GitHub Container Registry
48-
uses: docker/login-action@v1
49-
with:
50-
registry: ghcr.io
51-
username: ${{ github.actor }}
52-
password: ${{ secrets.GITHUB_TOKEN }}
53-
if: ${{ steps.compute-tag.outputs.result != 'FALSE' }}
54-
55-
-
56-
name: Set up QEMU
57-
uses: docker/setup-qemu-action@v1
58-
with:
59-
platforms: all
60-
61-
-
62-
name: Install Buildx
63-
id: buildx
64-
uses: docker/setup-buildx-action@master
65-
with:
66-
version: latest
67-
68-
-
69-
name: Build Image and Push to GitHub Container Registry and DockerHub
70-
uses: docker/build-push-action@v2
71-
if: ${{ steps.compute-tag.outputs.result != 'FALSE' }}
72-
with:
73-
context: docker
74-
file: docker/Dockerfile
75-
tags: |
76-
ls1tum/eos:${{ steps.compute-tag.outputs.result }}
77-
ghcr.io/ls1intum/eos:${{ steps.compute-tag.outputs.result }}
78-
platforms: linux/amd64,linux/arm64/v8
79-
push: ${{ !startsWith(steps.compute-tag.outputs.result, 'pr-') }}
17+
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@main
18+
with:
19+
docker-file: docker/Dockerfile
20+
docker-context: docker
21+
image-name: ls1intum/eos
8022

8123
test-solution:
8224
name: Run Tests for Solution
83-
needs: buildx
25+
needs: build
8426
runs-on: ubuntu-latest
85-
container: ls1tum/eos:0.0.5
27+
container: ghcr.io/ls1intum/eos:${{ needs.build.outputs.image_tag }}
8628
steps:
8729
- name: Checkout repository
8830
uses: actions/checkout@v4
@@ -98,9 +40,9 @@ jobs:
9840

9941
test-template:
10042
name: Run Tests for Template
101-
needs: buildx
43+
needs: build
10244
runs-on: ubuntu-latest
103-
container: ls1tum/eos:0.0.5
45+
container: ghcr.io/ls1intum/eos:${{ needs.build.outputs.image_tag }}
10446
steps:
10547
- name: Checkout repository
10648
uses: actions/checkout@v4

0 commit comments

Comments
 (0)