Skip to content

Commit

Permalink
Adding the possibility to build snapshot releases
Browse files Browse the repository at this point in the history
  • Loading branch information
danakim committed Nov 27, 2023
1 parent 704d91d commit 110b8af
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,39 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
server-id: openconext-releases
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Set up cache
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Determine the version
run: echo ::set-output name=version::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
id: versioncheck

- name: Exit when workflow_dispatch is triggered, and the version does not contain SNAPSHOT in it's name
run: |
echo "Only SNAPSHOT releases can be triggered with the workflow_dispatch"
exit 1
if: github.event_name == 'workflow_dispatch' && ( !endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT'))

- name: Exit when a production build is triggered, and the github tag is not the same as the version in pom.xml
run: |
echo "Project version ${{ steps.versioncheck.outputs.version }} does not match git tag ${{ github.ref_name }}"
exit 1
if: github.event_name != 'workflow_dispatch' && steps.versioncheck.outputs.version != github.ref_name

- name: Deploy with Maven
run: mvn --batch-mode deploy -DskipTests
env:
Expand All @@ -52,7 +71,7 @@ jobs:
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-oidc-playground/oidc-playground-client:${{ github.ref_name }}
ghcr.io/openconext/openconext-oidc-playground/oidc-playground-client:${{ steps.versioncheck.outputs.version }}
- name: Build and push the oidc playground server image
uses: docker/build-push-action@v4
Expand All @@ -62,4 +81,4 @@ jobs:
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-oidc-playground/oidc-playground-server:${{ github.ref_name }}
ghcr.io/openconext/openconext-oidc-playground/oidc-playground-server:${{ steps.versioncheck.outputs.version }}

0 comments on commit 110b8af

Please sign in to comment.