diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml deleted file mode 100644 index 6a2b4ee..0000000 --- a/.github/workflows/build-image.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -name: 'Build image' - -on: - push: - branches: - - main - tags: - - '*' - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - ${{ secrets.DOCKER_USERNAME }}/ozone-maintenance-page - tags: | - type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} - type=ref,event=tag - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: linux/amd64,linux/arm64 - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - if: github.event_name != 'pull_request' - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build - uses: docker/build-push-action@v2 - with: - builder: ${{ steps.buildx.outputs.name }} - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..dddd091 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,50 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + release: + types: [published] + +jobs: + validate: + uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-build-test.yml@main + secrets: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + + pre-release: + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + needs: validate + uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-publish.yml@main + secrets: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + + release: + if: ${{ github.event_name == 'release' }} + needs: validate + uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-publish.yml@main + secrets: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + + docker-pre-release: + needs: pre-release + uses: mekomsolutions/shared-github-workflow/.github/workflows/docker-build-publish.yml@main + with: + image-name: "ozone-maintenance-page" + secrets: + DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + + docker-release: + needs: release + uses: mekomsolutions/shared-github-workflow/.github/workflows/docker-build-publish.yml@main + with: + image-name: "ozone-maintenance-page" + secrets: + DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} diff --git a/.github/workflows/publish-to-nexus.yaml b/.github/workflows/publish-to-nexus.yaml deleted file mode 100644 index 31ce57a..0000000 --- a/.github/workflows/publish-to-nexus.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: Validate and optionally publish (if pushed on main) - -on: - pull_request: - branches: [main] - push: - workflow_dispatch: - -jobs: - build-and-publish: - uses: mekomsolutions/mekom-github-workflow-maven/.github/workflows/build-publish-workflow.yml@main - with: - webhook-url: https://openmrs-cd.mekomsolutions.net/generic-webhook-trigger/invoke - secrets: - NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} - NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} - OCD3_USERNAME: ${{ secrets.OCD3_USERNAME }} - OCD3_PASSWORD: ${{ secrets.OCD3_PASSWORD }} - if: ${{ github.ref == 'refs/heads/main' }} \ No newline at end of file