This repository was archived by the owner on Nov 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (67 loc) · 2.61 KB
/
Copy pathcicd.yml
File metadata and controls
82 lines (67 loc) · 2.61 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
name: CI/CD
on: [push, pull_request, workflow_dispatch]
env:
DOCKERHUB_USERNAME: suniastar
DOCKER_BASE: openjdk:17-slim
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2.4.0
- name: Setup Java JDK
uses: actions/setup-java@v2.4.0
with:
distribution: 'zulu'
java-version: 17
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1.0.4
- name: Setup Gradle Build
uses: gradle/gradle-build-action@v2.0.1
- name: Build JAR Archives
run: ./gradlew --no-daemon build
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: logldap
path: logldap/build/libs/
deploy:
name: Deploy
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: build
steps:
- name: Checkout Repository
uses: actions/checkout@v2.4.0
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: logldap
path: logldap/build/libs/
- name: Build logldap Docker image
run: |
cd ./logldap
docker pull ${{ env.DOCKER_BASE }}
docker build \
--pull \
--label "org.opencontainers.image.created=$(date --rfc-3339=seconds)" \
--label "org.opencontainers.image.authors=Frederik Enste <frederik@fenste.de>" \
--label "org.opencontainers.image.url=https://github.com/suniastar/scan-log4shell" \
--label "org.opencontainers.image.source=https://github.com/suniastar/scan-log4shell.git" \
--label "org.opencontainers.image.version=0.1" \
--label "org.opencontainers.image.vendor=suniastar" \
--label "org.opencontainers.image.title=LogLDAP" \
--label "org.opencontainers.image.description=A mock LDAP server that locks incomming requests." \
--label "org.opencontainers.image.base.name=${{ env.DOCKER_BASE }}" \
--label org.opencontainers.image.base.digest=$(docker image inspect ${{ env.DOCKER_BASE }} | grep -o 'Id": "[a-z0-9:]*' | sed 's/Id": "//g') \
--tag "${{ env.DOCKERHUB_USERNAME }}/logldap:latest" \
.
cd -
- name: Docker Login
uses: docker/login-action@v1.10.0
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Upload Docker image
run: docker push "${{ env.DOCKERHUB_USERNAME }}/logldap:latest"