diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 00000000..9c6fa898 --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,111 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: Build and Push + +on: + push: + branches: [ "master" ] + tags: + - '**' + +permissions: + contents: read + checks: write + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-jar-release: + name: Build Default site version + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Build with Gradle + run: ./gradlew assemble + env: + ARCHAPPL_SITEID: "default" + - name: Upload package + if: always() + uses: actions/upload-artifact@v4 + with: + name: default-package + path: build/distributions/*.tar.gz + + build-and-push-image: + permissions: + contents: read + packages: write + runs-on: ubuntu-latest + strategy: + matrix: + imagetag: + - singletomcat + - mgmt + - etl + - engine + - retrieval + steps: + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Build with Gradle + run: ./gradlew assemble + env: + ARCHAPPL_SITEID: "default" + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: | + latest=false + prefix=${{matrix.imagetag}}- + tags: | + type=ref,event=pr,prefix=${{ matrix.imagetag }}-pr- + type=sha,prefix=${{ matrix.imagetag }}- + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + push: true + platforms: linux/amd64,linux/arm64 + target: ${{matrix.imagetag}} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/ci.yml b/.github/workflows/test-and-build.yml similarity index 66% rename from .github/workflows/ci.yml rename to .github/workflows/test-and-build.yml index f1e9b64c..a50e14d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test-and-build.yml @@ -5,7 +5,7 @@ # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle -name: Test and Build +name: Test and Build Test Versions on: push: @@ -101,7 +101,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - siteid: ["slacdev", "default"] + siteid: ["slacdev", "default", "tests"] steps: - uses: actions/checkout@v4 @@ -125,65 +125,3 @@ jobs: with: name: ${{ matrix.siteid }}-package path: build/distributions/*.tar.gz - - build-and-push-image: - needs: [unittests, epicstests] - permissions: - contents: read - packages: write - runs-on: ubuntu-latest - strategy: - matrix: - imagetag: - - singletomcat - - mgmt - - etl - - engine - - retrieval - steps: - - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 - - name: Build with Gradle - run: ./gradlew assemble - env: - ARCHAPPL_SITEID: "default" - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - flavor: | - latest=false - prefix=${{matrix.imagetag}}- - tags: | - type=ref,event=pr,prefix=${{ matrix.imagetag }}-pr- - type=sha,prefix=${{ matrix.imagetag }}- - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile - push: true - platforms: linux/amd64,linux/arm64 - target: ${{matrix.imagetag}} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max