build: bump MongoDb version to '7.0.15' #139
Workflow file for this run
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: Publish Docker image | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
build_latest: auto | |
jobs: | |
build_test_container: | |
name: Build new Test Container | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2.1.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4.3.0 | |
with: | |
images: mongocamp/mongodb | |
flavor: | | |
latest=false | |
tags: | | |
type=raw,value=${{ github.sha }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4.0.0 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
test: | |
name: Run Tests | |
needs: build_test_container | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
mongodb-port: [ '27017', '4711' ] | |
mongodb-username: [ 'root', 'test' ] | |
mongodb-pwd: [ 'NONE', 'hello-world' ] | |
mongodb-replica-set: [ '', 'my-replication' ] | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Start MongoDB ${{ matrix.mongodb-version }} | |
uses: MongoCamp/mongodb-github-action@1.2.0 | |
with: | |
mongodb-version: ${{ github.sha }} | |
mongodb-port: ${{ matrix.mongodb-port }} | |
mongodb-username: ${{ matrix.mongodb-username }} | |
mongodb-pwd: ${{ matrix.mongodb-pwd }} | |
mongodb-replica-set: ${{ matrix.mongodb-replica-set }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3.3.0 | |
with: | |
distribution: 'corretto' | |
java-version: 17 | |
- name: Run tests | |
env: | |
mongodb-version: ${{ matrix.mongodb-version }} | |
mongodb-port: ${{ matrix.mongodb-port }} | |
mongodb-username: ${{ matrix.mongodb-username }} | |
mongodb-pwd: ${{ matrix.mongodb-pwd }} | |
mongodb-replica-set: ${{ matrix.mongodb-replica-set }} | |
run: cd test; sbt test; | |
cleanup_registry: | |
name: Cleanup Docker Registry | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Cleanup Docker Registry | |
if: always() | |
continue-on-error: true | |
run: | | |
TOKEN=`curl -s -H "Content-Type: application/json" -X POST -H "Content-Type: application/json" -d '{"username":"${{ secrets.DOCKERHUB_USER }}", "password":"${{ secrets.DOCKERHUB_PASSWORD }}"}' "https://hub.docker.com/v2/users/login/" | jq -r .token` | |
curl "https://hub.docker.com/v2/repositories/mongocamp/mongodb/tags/${{ github.sha }}/" -X DELETE -H "Authorization: JWT ${TOKEN}" | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2.1.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4.3.0 | |
with: | |
images: mongocamp/mongodb | |
flavor: | | |
latest=${{ env.build_latest }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4.0.0 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Update readme at Dockerhub | |
if: ${{ env.build_latest == 'auto' }} | |
uses: meeDamian/sync-readme@v1.0.6 | |
with: | |
user: ${{ secrets.DOCKERHUB_USER }} | |
pass: ${{ secrets.DOCKERHUB_PASSWORD }} | |
slug: mongocamp/mongodb | |
readme: README.md | |
description: true |