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: Maven Package and pushing docker | |
on: | |
release: | |
types: [published] | |
# pull_request: | |
# branches: main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
outputs: | |
jar_version: ${{ steps.bump.outputs.jar_version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: change Web.xml to avoid use of ssl | |
id: webxml | |
run: | | |
rm ${{ github.workspace }}/src/main/webapp/WEB-INF/web.xml | |
mv ${{ github.workspace }}/docker/tomcat/web-no-ssl.xml ${{ github.workspace }}/src/main/webapp/WEB-INF/web.xml | |
- name: Build a package | |
run: | | |
mvn versions:set -DnewVersion="${{ github.event.release.tag_name }}" | |
mvn -B -U --file pom.xml clean package -P release | |
- name: Bump jar version | |
id: bump | |
run: | | |
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
echo "jar_version=${PROJECT_VERSION}" >> $GITHUB_OUTPUT | |
- name: Temporarily save jar artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: jar-artifact | |
path: ${{ github.workspace }}/target/*.war | |
retention-days: 1 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: jar-artifact | |
path: target/ | |
- name: Docker build | |
run: | | |
docker build . --file docker/webstudio.dockerfile --target image-no-ssl \ | |
-t ${{ secrets.DOCKER_HUB_REPO }}/${{ secrets.DOCKER_HUB_REPO }}-webstudio-no-ssl:${{needs.build.outputs.jar_version}} \ | |
-t ${{ secrets.DOCKER_HUB_REPO }}/${{ secrets.DOCKER_HUB_REPO }}-webstudio-no-ssl:latest \ | |
--build-arg WEBSTUDIO_WAR_PATH=target/webstudio-${{needs.build.outputs.jar_version}}.war | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker push | |
run: | | |
docker push ${{ secrets.DOCKER_HUB_REPO }}/${{ secrets.DOCKER_HUB_REPO }}-webstudio-no-ssl:${{needs.build.outputs.jar_version}} | |
# run: | |
# runs-on: ubuntu-18.04 | |
# needs: [build, deploy] | |
# steps: | |
# - name: Run container | |
# run: | | |
# docker run ${{ secrets.DOCKER_HUB_REPO }}/${{ secrets.DOCKER_HUB_REPO }}-webstudio-no-ssl:${{needs.build.outputs.jar_version}} |