From f9977d5ce6f17554b4f2d1c6461c3ce159bf1850 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 12 Jan 2022 14:49:34 -0800 Subject: [PATCH] Actions workflow (#601) Signed-off-by: Dan Schaper --- .github/workflows/build-deploy.yml | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/build-deploy.yml diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml new file mode 100644 index 00000000..068c481d --- /dev/null +++ b/.github/workflows/build-deploy.yml @@ -0,0 +1,54 @@ +name: Maven CI/CD + +on: + push: + branches: [master] + workflow_dispatch: + +jobs: + build_and_publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: "11" + distribution: "temurin" + cache: maven + - name: Build with Maven + run: mvn -Pprod -DskipTests clean install + - name: Upload war artifact + uses: actions/upload-artifact@v2 + with: + name: docs-web-ci.war + path: docs-web/target/docs*.war + + build_docker_image: + name: Publish to Docker Hub + runs-on: ubuntu-latest + needs: [build_and_publish] + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Download war artifact + uses: actions/download-artifact@v2 + with: + name: docs-web-ci.war + path: docs-web/target + - name: Setup up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/docs:latest \ No newline at end of file