|
18 | 18 | with: |
19 | 19 | distribution: 'temurin' |
20 | 20 | java-version: '17' |
| 21 | + - name: Set version number, data and short git hash |
| 22 | + run: | |
| 23 | + echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> ${GITHUB_ENV} |
| 24 | + echo "SHORT_GIT_SHA=$(git rev-parse --short HEAD)" >> ${GITHUB_ENV} |
| 25 | + echo "BUILD_DATE"=$(date -u +"%Y-%m-%dT%H:%M:%SZ") >> ${GITHUB_ENV} |
| 26 | + echo "OCI_FLOATING_TAG=${OCI_RELEASE_CANDIDATE:-snapshot}" >> ${GITHUB_ENV} |
21 | 27 | - name: Compile source without tests |
22 | 28 | run: | |
23 | 29 | make |
|
29 | 35 | with: |
30 | 36 | name: artifacts |
31 | 37 | path: target/artifacts |
| 38 | + - name: Set a OCI floating tag for a release |
| 39 | + if: startsWith(github.ref, 'refs/tags/v') |
| 40 | + run: | |
| 41 | + echo "OCI_RELEASE_CANDIDATE=latest" >> ${GITHUB_ENV} |
| 42 | + - name: Set up QEMU |
| 43 | + uses: docker/setup-qemu-action@v3 |
| 44 | + - name: Set up Docker Buildx |
| 45 | + uses: docker/setup-buildx-action@v3 |
| 46 | + - name: Login to Docker Hub |
| 47 | + uses: docker/login-action@v3 |
| 48 | + with: |
| 49 | + registry: ghcr.io |
| 50 | + username: ${{ github.repository_owner }} |
| 51 | + password: ${{ secrets.GHCR_PAT }} |
| 52 | + - name: Build container image |
| 53 | + uses: docker/build-push-action@v6 |
| 54 | + with: |
| 55 | + context: . |
| 56 | + platforms: linux/amd64,linux/arm64 |
| 57 | + push: true |
| 58 | + build-args: | |
| 59 | + DATE=${{ env.BUILD_DATE }} |
| 60 | + GIT_SHORT_HASH=${{ env.SHORT_GIT_SHA }} |
| 61 | + VERSION=${{ env.VERSION }} |
| 62 | + tags: ghcr.io/opennms-forge/jrobin-to-rrdtool-converter:${{ env.SHORT_GIT_SHA }},ghcr.io/opennms-forge/jrobin-to-rrdtool-converter:${{ env.VERSION }},ghcr.io/opennms-forge/jrobin-to-rrdtool-converter:${{ env.OCI_FLOATING_TAG }} |
32 | 63 | release: |
33 | 64 | if: startsWith(github.ref, 'refs/tags/v') |
34 | 65 | runs-on: ubuntu-latest |
|
0 commit comments