Skip to content

Deploy

Deploy #106

Workflow file for this run

---
name: Maven install
on:
workflow_dispatch:
push:
tags:
- "*"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
deployment:
permissions:
packages: write
environment: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.7
- 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 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: Set docker labels and tags
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
latest=false
tags: |
type=ref,event=tag
type=semver,pattern={{version}},value=${{ steps.versioncheck.outputs.version }}
type=sha
- name: Debug the tag vars
run: echo "The value of tags is ${{ steps.meta.outputs.tags }}"
- name: Debug the label vars
run: echo "The value of label is ${{ steps.meta.outputs.labels }}"
# - name: Set up JDK 17 for snapshots
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'
# cache: 'maven'
# server-id: openconext-snapshots
# server-username: MAVEN_USERNAME
# server-password: MAVEN_PASSWORD
# if: ( endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT'))
#
# - name: Set up JDK 17 for releases
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'
# cache: 'maven'
# server-id: openconext-releases
# server-username: MAVEN_USERNAME
# server-password: MAVEN_PASSWORD
# if: ${{!( endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT')) }}
#
# - name: Deploy with Maven
# run: mvn --batch-mode deploy -DskipTests
# env:
# MAVEN_USERNAME: ${{ secrets.BUILD_USERNAME }}
# MAVEN_PASSWORD: ${{ secrets.BUILD_PASSWORD }}
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
#
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Set docker labels and tags
# id: meta
# uses: docker/metadata-action@v5
# with:
# flavor: |
# latest=false
# tags: |
# type=ref,event=tag
# type=semver,pattern=${{ steps.versioncheck.outputs.version }}
# type=sha
#
# - name: Debug the tag vars
# run: echo "The value of tags is ${{ steps.meta.outputs.tags }}"
#
# - name: Debug the label vars
# run: echo "The value of label is ${{ steps.meta.outputs.labels }}"
#
#
# - name: Build and push the server image
# uses: docker/build-push-action@v4
# with:
# context: server
# file: server/docker/Dockerfile
# platforms: linux/amd64
# push: true
# tags: ghcr.io/openconext/openconext-invite/inviteserver:${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
#
# - name: Build and push the client image
# uses: docker/build-push-action@v4
# with:
# context: client
# file: client/docker/Dockerfile
# platforms: linux/amd64
# push: true
# tags: ghcr.io/openconext/openconext-invite/inviteclient:${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
#
# - name: Build and push the welcome image
# uses: docker/build-push-action@v4
# with:
# context: welcome
# file: welcome/docker/Dockerfile
# platforms: linux/amd64
# push: true
# tags: ghcr.io/openconext/openconext-invite/invitewelcome:${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
#
# - name: Build and push the provisioning mock image
# uses: docker/build-push-action@v4
# with:
# context: provisioning-mock
# file: provisioning-mock/docker/Dockerfile
# platforms: linux/amd64
# push: true
# tags: ghcr.io/openconext/openconext-invite/inviteprovisioningmock:${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}