-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (83 loc) · 2.77 KB
/
cd.yml
File metadata and controls
96 lines (83 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: CD
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
run_kotlin_tests:
name: Run kotlin tests
uses: ./.github/workflows/run-kotlin-tests.yml
publish_docker_image_to_docker_hub:
needs: run_kotlin_tests
name: Build & Push docker image to Docker Hub
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Extract metadata to env variables
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: "arm64"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.JORE4_DOCKERHUB_USER }}
password: ${{ secrets.JORE4_DOCKERHUB_TOKEN }}
- name: Build and push dev builds to Docker Hub
run: |
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--cache-from type=registry,ref=$IMAGE_NAME:builder \
--cache-to type=registry,ref=$IMAGE_NAME:builder,mode=max \
--tag $IMAGE_NAME:builder \
.
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--cache-from type=registry,ref=$IMAGE_NAME:builder \
--tag $IMAGE_NAME:$COMMIT_ID \
.
- name: Build and push :latest tag to Docker Hub
if: ${{ github.ref == 'refs/heads/main' }}
run: |
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--cache-from type=registry,ref=$IMAGE_NAME:builder \
--tag $IMAGE_NAME:latest \
.
publish_docker_image_to_acr:
needs:
- run_kotlin_tests
name: Publish Docker image to ACR
permissions:
id-token: write
contents: read
uses: HSLdevcom/jore4-tools/.github/workflows/shared-build-and-publish-docker-image.yml@shared-build-and-publish-docker-image-v1
with:
docker_image_name: jore4-timetables-api
build_arm64_image: true
secrets:
azure_client_id: ${{ secrets.AZURE_CLIENT_ID }}
azure_tenant_id: ${{ secrets.AZURE_TENANT_ID }}
azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
run_cypress_tests:
needs:
- run_kotlin_tests
- publish_docker_image_to_acr
name: Run E2E tests
runs-on: ubuntu-24.04
steps:
- name: Start e2e env
uses: HSLdevcom/jore4-tools/github-actions/run-ci@main
with:
timetablesapi_version: "${{ needs.publish_docker_image_to_acr.outputs.docker_image }}"