diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..018199d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,44 @@ +--- +name: Build +on: + push: + +jobs: + Build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - uses: docker/metadata-action@v5 + id: meta + with: + images: Build + + - name: Cache + uses: actions/cache@v3 + id: cache + with: + path: | + maven-cache + key: cache-${{ hashFiles('.github/workflows/test/Dockerfile') }} + + - name: inject cache into docker + uses: reproducible-containers/buildkit-cache-dance@v3.1.0 + with: + cache-map: | + { + "maven-cache": "/root/.m2", + } + skip-extraction: ${{ steps.cache.outputs.cache-hit }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + cache-from: type=gha + cache-to: type=gha,mode=max + file: Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} +