This repository has been archived by the owner on Jun 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 2.1 KB
/
main.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
50
51
52
53
54
name: Build and push
on:
workflow_dispatch:
push:
branches:
- master
env:
IMAGE_DOCKER_PKG: docker.pkg.github.com/${{ github.repository }}/pus-nais-java-app
IMAGE_GHCR: ghcr.io/${{ github.repository }}/pus-nais-java-app
jobs:
build-and-push:
name: Build and push
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build and push Docker images to docker.pkg.github.com
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} --password-stdin
docker build -t ${IMAGE_DOCKER_PKG}:java8 java-8
docker build -t ${IMAGE_DOCKER_PKG}:java11 java-11
docker build -t ${IMAGE_DOCKER_PKG}:java13 java-13
docker build -t ${IMAGE_DOCKER_PKG}:java15 java-15
docker build -t ${IMAGE_DOCKER_PKG}:java16 java-16
docker build -t ${IMAGE_DOCKER_PKG}:java17 java-17
docker push ${IMAGE_DOCKER_PKG}:java8
docker push ${IMAGE_DOCKER_PKG}:java11
docker push ${IMAGE_DOCKER_PKG}:java13
docker push ${IMAGE_DOCKER_PKG}:java15
docker push ${IMAGE_DOCKER_PKG}:java16
docker push ${IMAGE_DOCKER_PKG}:java17
- name: Build and push Docker images to ghcr.io
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo ${GITHUB_TOKEN} | docker login ghcr.io -u ${GITHUB_REPOSITORY} --password-stdin
docker build -t ${IMAGE_GHCR}:java8 java-8
docker build -t ${IMAGE_GHCR}:java11 java-11
docker build -t ${IMAGE_GHCR}:java13 java-13
docker build -t ${IMAGE_GHCR}:java15 java-15
docker build -t ${IMAGE_GHCR}:java16 java-16
docker build -t ${IMAGE_GHCR}:java17 java-17
docker push ${IMAGE_GHCR}:java8
docker push ${IMAGE_GHCR}:java11
docker push ${IMAGE_GHCR}:java13
docker push ${IMAGE_GHCR}:java15
docker push ${IMAGE_GHCR}:java16
docker push ${IMAGE_GHCR}:java17