Skip to content

Adding github actions build script. #2

Adding github actions build script.

Adding github actions build script. #2

Workflow file for this run

name: Docker deploy
on:
push:
tags:
- 'v*.*.*'
paths-ignore:
- '*.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker image
id: build
run: docker build . -t dvfdocker/owlcms4:latest
shell: bash
- run: docker save dvfdocker/owlcms4:latest -o owlcms4.tar
- uses: actions/upload-artifact@v3
with:
name: owlcms4
path: owlcms4.tar
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Go offline using the pom.xml
run: mvn dependency:go-offline package -P production -am -pl owlcms -Dmaven.test.skip=true
- name: Build
run: mvn clean package -P production -am -pl owlcms -Dmaven.test.skip=true
- name: Run tests
run: mvn verify -am -pl owlcms
deploy:
runs-on: ubuntu-latest
needs: [test, build]
steps:
- uses: actions/download-artifact@v3
with:
name: owlcms4
- name: Get the version release
id: get_release_version
run: echo ::set-output name=VERSION::$(git describe --abbrev=0 --tags | cut -d "v" -f 2)
- run: docker load -i owlcms4.tar
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Tag builds
run: |-
docker tag dvfdocker/owlcms4:latest dvfdocker/owlcms4:latest
docker tag dvfdocker/owlcms4:latest dvfdocker/owlcms4:${{ steps.get_release_version.outputs.VERSION }}
- name: Push the version Docker image
run: docker push dvfdocker/owlcms4:${{ steps.get_release_version.outputs.VERSION }}
- name: Push the tagged Docker image
run: docker push dvfdocker/owlcms4:latest