Skip to content

Commit 69e41f6

Browse files
committed
Move creation of GitLab container to GitHub Actions
Although we duplicate code now, the intent is so much easier to follow
1 parent c51e4f7 commit 69e41f6

File tree

3 files changed

+82
-148
lines changed

3 files changed

+82
-148
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Build GitLab CI container (PR)'
2+
3+
on:
4+
push:
5+
pull_request_target:
6+
branches:
7+
- main
8+
9+
jobs:
10+
pr-gitlab:
11+
if: ${{ github.repository != 'domjudge/domjudge-packaging' || github.ref != 'main' }}
12+
name: PR GitLab image
13+
runs-on: ubuntu-latest
14+
permissions:
15+
packages: write
16+
contents: read
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Use the same PHP config as the contributor containers
21+
run: cp -r docker-{contributor,gitlabci}/php-config
22+
23+
- name: Log in to GitHub Container registry (possibly at fork)
24+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Extract metadata (tags, labels) for Docker
31+
id: meta
32+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
33+
with:
34+
images: ghcr.io/${{ github.repository }}
35+
36+
- name: Build and push Docker images
37+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
38+
with:
39+
context: "./docker-gitlabci"
40+
push: true
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: 'Build GitLab CI container (Accepted)'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
build-gitlab:
9+
if: ${{ github.repository == domjudge/domjudge-packaging && github.ref == main }}
10+
name: Build GitLab image
11+
runs-on: ubuntu-latest
12+
permissions:
13+
packages: write
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Use the same PHP config as the contributor containers
19+
run: cp -r docker-{contributor,gitlabci}/php-config
20+
21+
- name: Log in to Docker Container registry
22+
if: github.ref == 'refs/heads/main'
23+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_TOKEN }}
27+
28+
- name: Extract metadata (tags, labels) for Docker
29+
id: meta
30+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
31+
with:
32+
images: domjudge/gitlabci
33+
34+
- name: Build and push Docker images
35+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
36+
with:
37+
context: "./docker-gitlabci"
38+
push: true
39+
tags: "domjudge/gitlabci:22.04"
40+
labels: ${{ steps.meta.outputs.labels }}

.gitlab-ci.yml

Lines changed: 0 additions & 148 deletions
This file was deleted.

0 commit comments

Comments
 (0)