Skip to content

Commit 208e255

Browse files
feat: Dependencies and workflows updated. (#147)
1 parent e048ecc commit 208e255

File tree

6 files changed

+439
-721
lines changed

6 files changed

+439
-721
lines changed

.github/workflows/build-n-push-main.yml

Lines changed: 15 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -17,122 +17,34 @@ jobs:
1717
permissions:
1818
id-token: write
1919
packages: write
20-
contents: write
2120

2221
steps:
2322
#
2423
# Checkout the source code.
2524
#
2625
- name: Checkout the source code
27-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
28-
with:
29-
token: ${{ secrets.GIT_PAT }}
30-
fetch-depth: 0
31-
32-
#
33-
# Cache JDK.
34-
#
35-
- name: Cache JDK
36-
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
37-
id: cache-jdk
38-
with:
39-
key: OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz
40-
path: |
41-
${{ runner.temp }}/jdk_setup.tar.gz
42-
${{ runner.temp }}/jdk_setup.sha256
43-
44-
#
45-
# Download JDK and verify its hash.
46-
#
47-
- name: Download JDK and verify its hash
48-
if: steps.cache-jdk.outputs.cache-hit != 'true'
49-
run: |
50-
echo "454bebb2c9fe48d981341461ffb6bf1017c7b7c6e15c6b0c29b959194ba3aaa5 ${{ runner.temp }}/jdk_setup.tar.gz" >> ${{ runner.temp }}/jdk_setup.sha256
51-
curl -L "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz" -o "${{ runner.temp }}/jdk_setup.tar.gz"
52-
sha256sum --check --status "${{ runner.temp }}/jdk_setup.sha256"
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
5327

5428
#
55-
# Setup JDK.
29+
# Setup Java Build Environment.
5630
#
57-
- name: Setup JDK
58-
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
31+
- name: Setup Java Build Environment
32+
uses: pagopa/mil-actions/setup-java-build-env@241c6c17f483229fdd4ac26c6d79d1d65be2659c # 1.1.1
5933
with:
60-
distribution: "jdkfile"
61-
jdkFile: "${{ runner.temp }}/jdk_setup.tar.gz"
62-
java-version: "21"
63-
cache: maven
34+
gh_user: ${{ secrets.GIT_USER }}
35+
gh_token: ${{ secrets.GIT_PAT }}
6436

6537
#
66-
# Cache Maven.
38+
# Build and push native container image.
6739
#
68-
- name: Cache Maven
69-
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
70-
id: cache-maven
40+
- name: Build and push native container image
41+
id: build_image
42+
uses: pagopa/mil-actions/build-push-native-image@241c6c17f483229fdd4ac26c6d79d1d65be2659c # 1.1.1
7143
with:
72-
key: apache-maven-3.9.6-bin.tar.gz
73-
path: |
74-
${{ runner.temp }}/maven_setup.tar.gz
75-
${{ runner.temp }}/maven_setup.sha256
76-
77-
#
78-
# Download Maven and verify its hash.
79-
#
80-
- name: Download Maven and verify its hash
81-
if: steps.cache-maven.outputs.cache-hit != 'true'
82-
run: |
83-
echo "6eedd2cae3626d6ad3a5c9ee324bd265853d64297f07f033430755bd0e0c3a4b ${{ runner.temp }}/maven_setup.tar.gz" >> ${{ runner.temp }}/maven_setup.sha256
84-
curl -L "https://archive.apache.org/dist/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz" -o "${{ runner.temp }}/maven_setup.tar.gz"
85-
sha256sum --check --status "${{ runner.temp }}/maven_setup.sha256"
86-
87-
#
88-
# Setup Maven.
89-
#
90-
- name: Setup Maven
91-
run: |
92-
mkdir ${{ runner.temp }}/maven
93-
tar -xvf ${{ runner.temp }}/maven_setup.tar.gz -C ${{ runner.temp }}/maven --strip-components=1
94-
echo "<settings><servers><server><id>github</id><username>${{ secrets.GIT_USER }}</username><password>${{ secrets.GIT_PAT }}</password></server></servers></settings>" >> ${{ runner.temp }}/settings.xml
95-
96-
#
97-
# Build native executable.
98-
#
99-
- name: Build native executable
100-
run: |
101-
${{ runner.temp }}/maven/bin/mvn clean package \
102-
-Pnative \
103-
-Dmaven.test.skip=${{ github.event.inputs.skip-unit-test }} \
104-
-Dquarkus.native.container-build=true \
105-
-Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image@sha256:ce70e1a8016471ff0fc9c8f048cd9e37afddacd3de37ed0bca74201d102e45f5 \
106-
-s ${{ runner.temp }}/settings.xml \
107-
--no-transfer-progress
108-
109-
#
110-
# Build Docker image.
111-
#
112-
- name: Build Docker image
113-
run: |
114-
BRANCH_NAME="${GITHUB_REF////_}"
115-
echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV
116-
docker build \
117-
-f src/main/docker/Dockerfile.native-micro \
118-
-t ghcr.io/${{ github.repository }}:$BRANCH_NAME \
119-
.
120-
121-
#
122-
# Push Docker image.
123-
#
124-
- name: Push Docker image
125-
run: |
126-
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
127-
docker push -a ghcr.io/${{ github.repository }}
128-
129-
#
130-
# Get Docker image with sha256.
131-
#
132-
- name: Get Docker image with sha256
133-
run: |
134-
echo "image_sha256_temp=$(docker image inspect -f '{{index .RepoDigests 0}}' ghcr.io/${{ github.repository }}:${{ env.branch_name }})"
135-
echo "image_sha256=${image_sha256_temp/@/:${{ env.branch_name }}@}" >> "$GITHUB_ENV"
44+
gh_token: ${{ secrets.GIT_PAT }}
45+
sonar_token: ${{ secrets.SONAR_TOKEN }}
46+
release_version: "${GITHUB_REF////_}"
47+
skip_test: ${{ inputs.skip-unit-test }}
13648

13749
#
13850
# Update Container App.
@@ -146,4 +58,4 @@ jobs:
14658
ARM_TENANT_ID: "${{ secrets.AZURE_TENANT_ID }}"
14759
run: |
14860
terraform init -backend-config="env/dev-cd/backend.tfvars" -reconfigure
149-
terraform apply -var-file="env/dev-cd/terraform.tfvars" -var="mil_auth_image=${{ env.image_sha256 }}" -auto-approve -lock-timeout=300s
61+
terraform apply -var-file="env/dev-cd/terraform.tfvars" -var="mil_auth_image=${{ steps.build_image.outputs.image }}" -auto-approve -lock-timeout=300s

.github/workflows/deploy.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ jobs:
2424

2525
permissions:
2626
id-token: write
27-
packages: write
28-
contents: write
2927

3028
steps:
3129
#
@@ -40,10 +38,7 @@ jobs:
4038
# Checkout the source code
4139
#
4240
- name: Checkout the source code
43-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
44-
with:
45-
token: ${{ secrets.GIT_PAT }}
46-
fetch-depth: 0
41+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
4742

4843
#
4944
# Terraform

0 commit comments

Comments
 (0)