Skip to content

Commit

Permalink
Adding the posibility 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 ac011e7 commit 125b772
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion .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,4 +71,4 @@ jobs:
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-oidcng/oidcng-server:${{ github.ref_name }}
ghcr.io/openconext/openconext-oidcng/oidcng-server:${{ steps.versioncheck.outputs.version }}

0 comments on commit 125b772

Please sign in to comment.