Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[skip-release] Update action to conditionally publish #696

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
contains(github.event.pull_request.title, '[skip-release]') ||
contains(github.event.comment.body, '/skiprelease')
)
needs: [build-geoserver-docker-image, run-scenario-tests]
needs: [run-scenario-tests]
steps:
- uses: actions/checkout@v4
- name: Download artifact
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/deploy-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,21 @@ jobs:
- name: Get Current Date
id: current_date
run: echo "formatted=$(date -u +%Y.%m.%d)" >> $GITHUB_OUTPUT

- name: Check if image exists on Docker Hub
id: check_hub_image_exists
run: |
docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password ${{ secrets.DOCKERHUB_PASSWORD }}
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.DOCKERHUB_PASSWORD }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
check_image=$(curl --silent -f --head -lL https://hub.docker.com/v2/repositories/kartoza/geoserver/tags/${{ matrix.geoserverMajorVersion }}-${{ matrix.geoserverMinorVersion.minor }}.${{ matrix.geoserverMinorVersion.patch }}/ | head -n 1 | cut -d ' ' -f2) >> $GITHUB_OUTPUT

- name: Build prod image
if: github.actor != 'dependabot[bot]'
if: |
github.actor != 'dependabot[bot]' &&
!(
contains(github.event.pull_request.title, '[skip-release]') ||
contains(github.event.comment.body, '/skiprelease')
) && github.event.workflow_run.conclusion == 'success'
timeout-minutes: 15
id: docker_build_prod
uses: docker/build-push-action@v6
Expand All @@ -66,6 +79,7 @@ jobs:
push: true
tags: |
${{ secrets.DOCKERHUB_REPO }}/geoserver
${{ steps.check_hub_image_exists.outputs.check_image == 200 && format('{0}/postgis:{1}-{2}.{3}', secrets.DOCKERHUB_REPO, matrix.geoserverMajorVersion, geoserverMinorVersion.minor, matrix.geoserverMinorVersion.patch) || null}}
${{ secrets.DOCKERHUB_REPO }}/geoserver:${{ matrix.geoserverMajorVersion }}.${{ matrix.geoserverMinorVersion.minor }}.${{ matrix.geoserverMinorVersion.patch }}
${{ secrets.DOCKERHUB_REPO }}/geoserver:${{ matrix.geoserverMajorVersion }}.${{ matrix.geoserverMinorVersion.minor }}.${{ matrix.geoserverMinorVersion.patch }}--v${{ steps.current_date.outputs.formatted }}
build-args: |
Expand Down