From 348d25b2d920624b3a741f797d1532fe07af4f40 Mon Sep 17 00:00:00 2001 From: MASES Public Developers Team <94312179+masesdevelopers@users.noreply.github.com> Date: Thu, 14 Mar 2024 01:26:09 +0100 Subject: [PATCH] Updated to use Ubuntu instead of Debian (#386) * Update to use Ubuntu instead of Debian * Split release.yaml wotkflow into two linked workflows --- .github/workflows/docker.yaml | 87 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 75 +---------------------------- src/container/Dockerfile.linux | 4 +- 3 files changed, 90 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000000..b16e24ac59 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,87 @@ +# This is a basic workflow to help you get started with Actions + +name: CI_DOCKER + +# Controls when the action will run. Triggers the workflow on release published or release edited request +# events but only for the master branch +on: + workflow_run: + workflows: ["CI_RELEASE"] + branches: [master] + types: + - completed + workflow_dispatch: + +jobs: + build_container_linux: + runs-on: ubuntu-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + with: + fetch-depth: '1' + submodules: 'true' + + - name: Pre compile + run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src/net/JNet/JNet.csproj + + - name: Set up Apache Maven Central + uses: actions/setup-java@v4 + with: # running setup-java again overwrites the settings.xml + distribution: temurin + java-version: 11 + cache: 'maven' + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml + server-username: MAVEN_USERNAME # env variable for username in deploy + server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import + gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase + + - name: Install local file to be used within Javadoc plugin of generated POM + run: mvn install:install-file -DgroupId=JCOBridge -DartifactId=JCOBridge -Dversion=2.5.11 -Dpackaging=jar -Dfile=../../../bin/net8.0/JCOBridge.jar -f ./src/jvm/jnet/pom.xml + shell: bash + + - name: Create Jars + run: mvn --file ./src/jvm/jnet/pom.xml --no-transfer-progress package + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Container Registry + uses: docker/login-action@v3 + with: + username: ${{ secrets.MASES_DOCKER_HUB_USERNAME }} + password: ${{ secrets.MASES_DOCKER_HUB_PASSWORD }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + masesgroup/jnet + ghcr.io/${{ github.repository_owner }}/jnet + + - name: Build and push + uses: docker/build-push-action@v5 + with: + file: ./src/container/Dockerfile.linux + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c44840688c..62a4244960 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,80 +10,7 @@ on: - published # - edited -jobs: - build_container_linux: - runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 - with: - fetch-depth: '1' - submodules: 'true' - - - name: Pre compile - run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src/net/JNet/JNet.csproj - - - name: Set up Apache Maven Central - uses: actions/setup-java@v4 - with: # running setup-java again overwrites the settings.xml - distribution: temurin - java-version: 11 - cache: 'maven' - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - server-username: MAVEN_USERNAME # env variable for username in deploy - server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import - gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - - - name: Install local file to be used within Javadoc plugin of generated POM - run: mvn install:install-file -DgroupId=JCOBridge -DartifactId=JCOBridge -Dversion=2.5.11 -Dpackaging=jar -Dfile=../../../bin/net8.0/JCOBridge.jar -f ./src/jvm/jnet/pom.xml - shell: bash - - - name: Create Jars - run: mvn --file ./src/jvm/jnet/pom.xml --no-transfer-progress package - env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Container Registry - uses: docker/login-action@v3 - with: - username: ${{ secrets.MASES_DOCKER_HUB_USERNAME }} - password: ${{ secrets.MASES_DOCKER_HUB_PASSWORD }} - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: | - masesgroup/jnet - ghcr.io/${{ github.repository_owner }}/jnet - - - name: Build and push - uses: docker/build-push-action@v5 - with: - file: ./src/container/Dockerfile.linux - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - +jobs: # This workflow contains a single job called "build_release" build_release: # The type of runner that the job will run on diff --git a/src/container/Dockerfile.linux b/src/container/Dockerfile.linux index 41b9dbeefa..35680a8146 100644 --- a/src/container/Dockerfile.linux +++ b/src/container/Dockerfile.linux @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env +FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy AS build-env WORKDIR /app # Copy everything @@ -10,7 +10,7 @@ RUN dotnet restore JNetDocker.sln RUN dotnet publish ./JNetCLI/JNetCLI.csproj --framework net6.0 -c Release -o out # Build runtime image -FROM mcr.microsoft.com/dotnet/runtime:6.0 +FROM mcr.microsoft.com/dotnet/runtime:6.0-jammy # Add JRE RUN apt update