|
12 | 12 | - created |
13 | 13 |
|
14 | 14 | jobs: |
15 | | - buildx: |
| 15 | + build: |
16 | 16 | 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 |
80 | 22 |
|
81 | 23 | test-solution: |
82 | 24 | name: Run Tests for Solution |
83 | | - needs: buildx |
| 25 | + needs: build |
84 | 26 | runs-on: ubuntu-latest |
85 | | - container: ls1tum/eos:0.0.5 |
| 27 | + container: ghcr.io/ls1intum/eos:${{ needs.build.outputs.image_tag }} |
86 | 28 | steps: |
87 | 29 | - name: Checkout repository |
88 | 30 | uses: actions/checkout@v4 |
|
98 | 40 |
|
99 | 41 | test-template: |
100 | 42 | name: Run Tests for Template |
101 | | - needs: buildx |
| 43 | + needs: build |
102 | 44 | runs-on: ubuntu-latest |
103 | | - container: ls1tum/eos:0.0.5 |
| 45 | + container: ghcr.io/ls1intum/eos:${{ needs.build.outputs.image_tag }} |
104 | 46 | steps: |
105 | 47 | - name: Checkout repository |
106 | 48 | uses: actions/checkout@v4 |
|
0 commit comments