build CAS #127
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build CAS | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
check-latest: true | |
- name: build the exploded CAS webapp | |
run: | | |
./gradlew explodeWarOnly | |
- name: Calculating the docker image tag | |
if: github.repository == 'georchestra/georchestra-cas-server' | |
id: version | |
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) | |
- name: Build a docker image | |
run: | | |
docker build -t georchestra/cas:latest . | |
- name: Build a war file | |
run: | | |
./gradlew build | |
- name: publish the artifact | |
if: github.repository == 'georchestra/georchestra-cas-server' && github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: cas.war | |
path: build/libs/cas.war | |
- uses: docker/login-action@v1 | |
if: github.repository == 'georchestra/georchestra-cas-server' && (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/')) | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Publish the docker image | |
if: github.repository == 'georchestra/georchestra-cas-server' && github.ref == 'refs/heads/master' | |
run: | | |
docker push georchestra/cas:latest | |
- name: Publish the docker image (release / tag) | |
if: contains(github.ref, 'refs/tags/') && github.repository == 'georchestra/georchestra-cas-server' | |
run: | | |
docker tag georchestra/cas:latest georchestra/cas:${{ steps.version.outputs.VERSION }} | |
docker push georchestra/cas:${{ steps.version.outputs.VERSION }} |