Merge pull request #6 from annashamray/feature/document-verschijnings… #13
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 Alfresco content model | |
on: | |
push: | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
MAVEN_PROJECT_VERSION: 1.0-SNAPSHOT | |
jobs: | |
build-model: | |
name: Build model | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up JDK 11 | |
uses: actions/[email protected] | |
with: | |
java-version: 11 | |
- name: Update maven version | |
run: mvn versions:set -DnewVersion=${{ env.MAVEN_PROJECT_VERSION }} versions:commit | |
- name: Package Alfresco content model | |
run: mvn clean package | |
- name: Platform jar as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: openzaak-alfresco-platform-${{ env.MAVEN_PROJECT_VERSION }}.jar | |
path: openzaak-alfresco-platform/target/openzaak-alfresco-platform-${{ env.MAVEN_PROJECT_VERSION }}.jar | |
- name: Platform jar as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: openzaak-alfresco-share-${{ env.MAVEN_PROJECT_VERSION }}.jar | |
path: openzaak-alfresco-share/target/openzaak-alfresco-share-${{ env.MAVEN_PROJECT_VERSION }}.jar | |
- uses: actions/cache@v1 | |
with: | |
path: . | |
key: ${{ runner.os }}-docker-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-docker- | |
build-push-docker: | |
name: Build and push docker images | |
runs-on: ubuntu-latest | |
needs: build-model | |
steps: | |
- uses: actions/cache@v1 | |
with: | |
path: . | |
key: ${{ runner.os }}-docker-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-docker- | |
- name: Build docker image | |
run: docker-compose -f target/classes/docker/docker-compose.yml build --parallel openzaak-alfresco-share openzaak-alfresco-acs | |
- name: Docker images to tar | |
run: | | |
docker image save -o openzaak-alfresco-content-services-${{ env.MAVEN_PROJECT_VERSION }}.tar openzaak/alfresco-content-services:${{ env.MAVEN_PROJECT_VERSION }} | |
docker image save -o openzaak-alfresco-share-${{ env.MAVEN_PROJECT_VERSION }}.tar openzaak/alfresco-share:${{ env.MAVEN_PROJECT_VERSION }} | |
- name: Save Docker image Alfresco content services as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: openzaak-alfresco-content-services-${{ env.MAVEN_PROJECT_VERSION }}.tar | |
path: openzaak-alfresco-content-services-${{ env.MAVEN_PROJECT_VERSION }}.tar | |
- name: Save Docker image Alfresco share as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: openzaak-alfresco-share-${{ env.MAVEN_PROJECT_VERSION }}.tar | |
path: openzaak-alfresco-share-${{ env.MAVEN_PROJECT_VERSION }}.tar | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
if: github.ref == 'refs/heads/main' | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Push to docker images to dockerhub | |
if: github.ref == 'refs/heads/main' | |
run: | | |
docker push openzaak/alfresco-content-services:${{ env.MAVEN_PROJECT_VERSION }} | |
docker push openzaak/alfresco-share:${{ env.MAVEN_PROJECT_VERSION }} |