diff --git a/.github/workflows/migrator_image.yml b/.github/workflows/migrator_image.yml new file mode 100644 index 0000000..eae8e22 --- /dev/null +++ b/.github/workflows/migrator_image.yml @@ -0,0 +1,54 @@ +name: Create and publish a Docker image + +on: + workflow_dispatch: + push: + branches: + - main + # TODO: Remove this before merge. + - migrator + tags: + - UnityAuth-* + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Log in to the Container registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9dc751fe249ad99385a2583ee0d084c400eee04e + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 + with: + context: . + file: MigratorDockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitignore b/.gitignore index 7516276..01fc4f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*~ /.gradle/ /.idea/ /.micronaut/ diff --git a/MigratorDockerfile b/MigratorDockerfile new file mode 100644 index 0000000..8ebd741 --- /dev/null +++ b/MigratorDockerfile @@ -0,0 +1,3 @@ +FROM flyway/flyway:10-alpine + +COPY src/main/resource/db/migration /flyway/sql