This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
Docker Image CI #774
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: Docker Image CI | |
on: | |
push: | |
branches: [ main ] | |
schedule: | |
- cron: '0 5 * * *' | |
workflow_dispatch: | |
jobs: | |
get-version-number: | |
runs-on: windows-latest | |
outputs: | |
FLYWAY_VERSION: ${{ steps.step1.outputs.CURRENT_FLYWAY_VERSION }} | |
CONTINUE: ${{ steps.step1.outputs.Continue }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: step1 | |
name: Compare latest flyway version with container | |
run: | | |
$manifestDataRaw = Invoke-WebRequest "https://download.red-gate.com/maven/release/org/flywaydb/enterprise/flyway-commandline/maven-metadata.xml" | |
$manifestData = [Xml]$manifestDataRaw | |
$latestFlywayVersion = $manifestData.metadata.versioning.release | |
$workerToolsTags = Invoke-RestMethod "https://registry.hub.docker.com/v2/repositories/octopuslabs/flyway-workertools/tags?page_size=50" | |
$matchingTag = $workerToolsTags.results | Where-Object { $_.name -eq $latestFlywayVersion } | |
echo "CURRENT_FLYWAY_VERSION=$latestFlywayVersion" >> $env:GITHUB_OUTPUT | |
if ($null -ne $matchingTag) | |
{ | |
Write-Host "Docker container already has latest version of flyway" | |
echo "CONTINUE=No" >> $env:GITHUB_OUTPUT | |
} | |
else | |
{ | |
Write-Host "We need to upgrade the flyway container to $latestFlywayVersion" | |
echo "CONTINUE=Yes" >> $env:GITHUB_OUTPUT | |
} | |
shell: powershell | |
build-ubuntu: | |
needs: [get-version-number] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: DockerHub Login | |
env: | |
USERNAME: ${{ secrets.DOCKER_HUB_USER }} | |
PASSWORD: ${{ secrets.DOCKER_HUB_PAT }} | |
run: docker login --username $USERNAME --password "$PASSWORD" | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Build the ubuntu-20.04 Docker image | |
env: | |
FLYWAY_VERSION_TO_BUILD: ${{ needs.get-version-number.outputs.FLYWAY_VERSION }} | |
run: docker build ./ubuntu-2004 --tag octopuslabs/flyway-workertools:$FLYWAY_VERSION_TO_BUILD-ubuntu.2004 --tag octopuslabs/flyway-workertools:latest-ubuntu.2004 --build-arg FLYWAY_VERSION=$FLYWAY_VERSION_TO_BUILD | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Push the ubuntu-20.04 version image | |
env: | |
FLYWAY_VERSION_TO_BUILD: ${{ needs.get-version-number.outputs.FLYWAY_VERSION }} | |
run: docker push octopuslabs/flyway-workertools:$FLYWAY_VERSION_TO_BUILD-ubuntu.2004 | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Push the latest ubuntu-20.04 image | |
run: docker push octopuslabs/flyway-workertools:latest-ubuntu.2004 | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Build the ubuntu-22.04 Docker image | |
env: | |
FLYWAY_VERSION_TO_BUILD: ${{ needs.get-version-number.outputs.FLYWAY_VERSION }} | |
run: docker build ./ubuntu-2204 --tag octopuslabs/flyway-workertools:$FLYWAY_VERSION_TO_BUILD-ubuntu.2204 --tag octopuslabs/flyway-workertools:latest-ubuntu.2204 --build-arg FLYWAY_VERSION=$FLYWAY_VERSION_TO_BUILD | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Push the ubuntu-22.04 version image | |
env: | |
FLYWAY_VERSION_TO_BUILD: ${{ needs.get-version-number.outputs.FLYWAY_VERSION }} | |
run: docker push octopuslabs/flyway-workertools:$FLYWAY_VERSION_TO_BUILD-ubuntu.2204 | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Push the latest ubuntu-22.04 image | |
run: docker push octopuslabs/flyway-workertools:latest-ubuntu.2204 | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
build-win-2019: | |
needs: [get-version-number] | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: DockerHub Login | |
env: | |
USERNAME: ${{ secrets.DOCKER_HUB_USER }} | |
PASSWORD: ${{ secrets.DOCKER_HUB_PAT }} | |
run: docker login --username ${env:USERNAME} --password "${env:PASSWORD}" | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Build the win2019 Docker image | |
env: | |
FLYWAY_VERSION_TO_BUILD: ${{ needs.get-version-number.outputs.FLYWAY_VERSION }} | |
run: docker build ./windows-2019 --tag octopuslabs/flyway-workertools:${env:FLYWAY_VERSION_TO_BUILD}-windows.2019 --tag octopuslabs/flyway-workertools:latest-windows.2019 --build-arg FLYWAY_VERSION=${env:FLYWAY_VERSION_TO_BUILD} | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Push the win2019 version image | |
env: | |
FLYWAY_VERSION_TO_BUILD: ${{ needs.get-version-number.outputs.FLYWAY_VERSION }} | |
run: docker push octopuslabs/flyway-workertools:${env:FLYWAY_VERSION_TO_BUILD}-windows.2019 | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Push the latest win2019 image | |
run: docker push octopuslabs/flyway-workertools:latest-windows.2019 | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
build-docker-manifest: | |
needs: [get-version-number, build-ubuntu, build-win-2019] | |
runs-on: ubuntu-latest | |
steps: | |
- name: DockerHub Login | |
env: | |
USERNAME: ${{ secrets.DOCKER_HUB_USER }} | |
PASSWORD: ${{ secrets.DOCKER_HUB_PAT }} | |
run: docker login --username $USERNAME --password "$PASSWORD" | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Build Manifest | |
run: docker manifest create octopuslabs/flyway-workertools:latest octopuslabs/flyway-workertools:latest-windows.2019 octopuslabs/flyway-workertools:latest-ubuntu.2004 | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Push Manifest | |
run: docker manifest push octopuslabs/flyway-workertools:latest | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Build Version Manifest | |
env: | |
FLYWAY_VERSION_TO_BUILD: ${{ needs.get-version-number.outputs.FLYWAY_VERSION }} | |
run: docker manifest create octopuslabs/flyway-workertools:$FLYWAY_VERSION_TO_BUILD octopuslabs/flyway-workertools:$FLYWAY_VERSION_TO_BUILD-windows.2019 octopuslabs/flyway-workertools:$FLYWAY_VERSION_TO_BUILD-ubuntu.2004 | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |
- name: Push Version Manifest | |
env: | |
FLYWAY_VERSION_TO_BUILD: ${{ needs.get-version-number.outputs.FLYWAY_VERSION }} | |
run: docker manifest push octopuslabs/flyway-workertools:$FLYWAY_VERSION_TO_BUILD | |
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }} | |