Skip to content

Commit a907c7b

Browse files
authored
Fix GH workflow for maven deploy (#10)
* fix maven deploy on release * disable attestation generation for cdoc2-server-liquibase images (generates broken images) * try to fix building for push (builds not triggered for push currently)
1 parent a5f40d3 commit a907c7b

File tree

6 files changed

+38
-14
lines changed

6 files changed

+38
-14
lines changed

.github/workflows/docker-release.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ jobs:
5353
labels: ${{ steps.meta.outputs.labels }}
5454

5555
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
56-
- name: Generate artifact attestation
57-
uses: actions/attest-build-provenance@v1
58-
with:
59-
#subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
60-
subject-name: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
61-
subject-digest: ${{ steps.push.outputs.digest }}
62-
push-to-registry: true
56+
# Broken: generates images with sha256, that fail to start with "unsupported media type application/vnd.oci.empty.v1+json"
57+
# - name: Generate artifact attestation
58+
# uses: actions/attest-build-provenance@v1
59+
# with:
60+
# #subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
61+
# subject-name: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
62+
# subject-digest: ${{ steps.push.outputs.digest }}
63+
# push-to-registry: true
6364

.github/workflows/maven-release.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,22 @@ jobs:
2323
distribution: 'temurin'
2424
settings-path: ${{ github.workspace }} # location for the settings.xml file
2525

26+
# Maven versioning is broken in so many ways (Maven is older than git). In semver you want to increase version only when there
27+
# are changes in module. Maven forces to change submodule version even when only change was main pom version change
28+
# Here: deploy for each submodule is necessary
29+
# to deploy submodules even when main module didn't change
2630
- name: Publish to GitHub Packages Apache Maven
27-
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
31+
run: |
32+
mvn deploy -s $GITHUB_WORKSPACE/settings.xml
33+
mvn -f cdoc2-shared-crypto deploy -Dmaven.test.skip=true -s $GITHUB_WORKSPACE/settings.xml
34+
mvn -f server-openapi deploy -Dmaven.test.skip=true -s $GITHUB_WORKSPACE/settings.xml
35+
mvn -f server-db deploy -Dmaven.test.skip=true -s $GITHUB_WORKSPACE/settings.xml
36+
mvn -f server-common deploy -Dmaven.test.skip=true -s $GITHUB_WORKSPACE/settings.xml
37+
mvn -f put-server deploy -Dmaven.test.skip=true -s $GITHUB_WORKSPACE/settings.xml
38+
mvn -f get-server deploy -Dmaven.test.skip=true -s $GITHUB_WORKSPACE/settings.xml
2839
env:
2940
GITHUB_TOKEN: ${{ github.token }}
41+
MAVEN_REPO: open-eid/cdoc2-capsule-server # maven repo to download dependencies
3042

3143
# test if username and password are correct (may still fail if no write access or wrong package name)
3244
- name: Log in to the Container registry

.github/workflows/maven.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,26 @@ env:
2020
jobs:
2121
fork_setup:
2222
runs-on: ubuntu-latest
23-
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }}
23+
2424
outputs:
2525
base_repo: ${{ steps.base_repo.outputs.name }}
2626
is_fork: ${{ steps.is_fork.outputs.is_fork }}
2727

2828
steps:
2929
- id: base_repo
30-
run: echo "name=${{github.event.pull_request.base.repo.full_name}}" >> "$GITHUB_OUTPUT"
30+
run: |
31+
if [ ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }} ]; then
32+
echo "name=${{github.event.pull_request.base.repo.full_name}}" >> "$GITHUB_OUTPUT"
33+
else
34+
echo "name=${{ github.event.repo.name }}" >> "$GITHUB_OUTPUT"
35+
fi
3136
- id: is_fork
32-
run: echo "is_fork=true" >> "$GITHUB_OUTPUT"
37+
run: |
38+
if [ ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }} ]; then
39+
echo "is_fork=true" >> "$GITHUB_OUTPUT"
40+
else
41+
echo "is_fork=false" >> "$GITHUB_OUTPUT"
42+
fi
3343
3444
build:
3545
runs-on: ubuntu-latest
@@ -56,6 +66,7 @@ jobs:
5666
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
5767
IS_FORK: ${{needs.fork_setup.outputs.is_fork}}
5868
BASE_REPO: ${{needs.fork_setup.outputs.base_repo}}
69+
MAVEN_REPO: ${{vars.MAVEN_REPO}} # set as repository variable: open-eid/cdoc2-capsule-server
5970

6071

6172
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive

get-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@
467467
</executions>
468468
<configuration>
469469
<failIfNotMatch>false</failIfNotMatch>
470-
<userProperty>true</userProperty>
470+
<userProperty>false</userProperty>
471471
<!--skip>true</skip-->
472472
</configuration>
473473
</plugin>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@
297297
</executions>
298298
<configuration>
299299
<failIfNotMatch>false</failIfNotMatch>
300-
<userProperty>true</userProperty>
300+
<userProperty>false</userProperty>
301301
<!--skip>true</skip-->
302302
</configuration>
303303
</plugin>

put-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@
464464
</executions>
465465
<configuration>
466466
<failIfNotMatch>false</failIfNotMatch>
467-
<userProperty>true</userProperty>
467+
<userProperty>false</userProperty>
468468
<!--skip>true</skip-->
469469
</configuration>
470470
</plugin>

0 commit comments

Comments
 (0)