-
Notifications
You must be signed in to change notification settings - Fork 6
49 lines (47 loc) · 2.05 KB
/
build.yml
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
name: Build images and push (on master branch or on schedule)
on:
push:
branches:
- "**"
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
base-image-tag: [16-bullseye, 18-bullseye, 16-bookworm, 18-bookworm, 20-bookworm]
steps:
- uses: actions/checkout@master
- name: Determine Java version
id: java_version
run: |
if [[ "${{ matrix.base-image-tag }}" == *"-bullseye" ]]; then
echo 'version=11' >> $GITHUB_OUTPUT
else
echo 'version=17' >> $GITHUB_OUTPUT
fi
- name: Test
run: |
chmod +x runTests.sh && ./runTests.sh ${{ matrix.base-image-tag }} ${{ steps.java_version.outputs.version }}
- name: Build
run: |
docker build --build-arg=BASE_IMAGE_TAG=${{ matrix.base-image-tag }} --build-arg=JAVA_VERSION=${{ steps.java_version.outputs.version }} --tag ppiper/node-browsers:${{ matrix.base-image-tag }} .
docker tag ppiper/node-browsers:${{ matrix.base-image-tag }} ghcr.io/sap/ppiper-node-browsers:${{ matrix.base-image-tag }}
- name: Tag latest image
if: ${{ matrix.base-image-tag == '20-bookworm' }}
run: |
docker tag ppiper/node-browsers:${{ matrix.base-image-tag }} ppiper/node-browsers:latest
docker tag ghcr.io/sap/ppiper-node-browsers:${{ matrix.base-image-tag }} ghcr.io/sap/ppiper-node-browsers:latest
- name: Push
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin
echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ secrets.CR_USER }} --password-stdin
docker push ppiper/node-browsers:${{ matrix.base-image-tag }}
docker push ghcr.io/sap/ppiper-node-browsers:${{ matrix.base-image-tag }}
if [ "${{ matrix.base-image-tag }}" == 20-bookworm ]; then
docker push ppiper/node-browsers:latest
docker push ghcr.io/sap/ppiper-node-browsers:latest
fi