Upgrade jenkinsfile-runner to Java 17 and Jenkins version 2.462.x #255
This file contains hidden or 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: Continuous Delivery | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| IMAGE_NAME: ${{ github.repository }} | |
| REGISTRY: ghcr.io | |
| jobs: | |
| build-maven: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: temurin | |
| - name: Build with Maven | |
| working-directory: . | |
| run: mvn -B package | |
| build-docker: | |
| runs-on: ubuntu-latest | |
| env: | |
| IMAGE_NAME: ${{ github.repository }} | |
| REGISTRY: ghcr.io | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - alias: jre-17 | |
| dockerfile: packaging/docker/unix/eclipse-temurin-17-jre/Dockerfile | |
| tags: test | |
| - alias: jre-17-alpine | |
| dockerfile: packaging/docker/unix/eclipse-temurin-17-jre-alpine/Dockerfile | |
| tags: test-alpine | |
| name: "Build Docker image: ${{ matrix.alias }}" | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y git | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v1.5.0 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v3.3.0 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v2.6.1 | |
| with: | |
| push: false | |
| file: ${{ matrix.dockerfile }} | |
| tags: ${{ matrix.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| deploy: | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - alias: jre-17 | |
| dockerfile: packaging/docker/unix/eclipse-temurin-17-jre/Dockerfile | |
| tag-prefix: eclipse-temurin-17-jre- | |
| tag-latest: true | |
| extra-tags: ", ghcr.io/${{ github.repository }}:jre-17" | |
| - alias: jre-17-alpine | |
| dockerfile: packaging/docker/unix/eclipse-temurin-17-jre-alpine/Dockerfile | |
| tag-prefix: eclipse-temurin-17-jre-alpine- | |
| tag-latest: false | |
| extra-tags: ", ghcr.io/${{ github.repository }}:alpine, ghcr.io/${{ github.repository }}:jre-17-alpine" | |
| needs: | |
| - build-maven | |
| - build-docker | |
| permissions: | |
| contents: read | |
| packages: write | |
| name: "Deploy Docker Image: ${{ matrix.alias }}" | |
| #TODO: There is slight double build overhead, but we prevent permissions from being exposed too widely | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v1.10.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v1.5.0 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v3.3.0 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| flavor: | | |
| latest=${{ matrix.tag-latest }} | |
| prefix=${{ matrix.tag-prefix }} | |
| suffix= | |
| - name: Build and Deploy Docker image | |
| uses: docker/build-push-action@v2.6.1 | |
| with: | |
| context: . | |
| file: ${{ matrix.dockerfile }} | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} ${{ matrix.extra-tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |