From c0653b7750117b5cd6acd5c4f3594d738262bdd4 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Fri, 3 Nov 2023 12:33:20 +0100 Subject: [PATCH] ci: first attempt docker image --- .gitea/workflows/server.yaml | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/.gitea/workflows/server.yaml b/.gitea/workflows/server.yaml index 62ade8d..96a6ea8 100644 --- a/.gitea/workflows/server.yaml +++ b/.gitea/workflows/server.yaml @@ -77,3 +77,62 @@ jobs: # set projectversion to be the branch name projectVersion: "${{ github.ref_name }}" bomFilename: "${{ github.workspace }}/bom.xml" + build-push-server-container: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup dotnet + uses: https://github.com/actions/setup-dotnet@v3 + with: + dotnet-version: 7.0 + # Add support for more platforms with QEMU (optional) + # https://github.com/docker/setup-qemu-action + - name: Set up QEMU + uses: https://github.com/docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v3.0.0 + - name: Login to Docker Hub + uses: https://github.com/docker/login-action@v3 + with: + registry: forge.rainote.dev + tags: | + Wonderking/Continuity:latest + Wonderking/Continuity:${{ github.ref_name }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + - name: Build and push + uses: https://github.com/docker/build-push-action@v5 + with: + context: ./Server/ + push: true + tags: user/repo:latest + platforms: linux/amd64,linux/arm64,linux/arm/v7 + dependency-track-container: + needs: build-push-server-container + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup dotnet + uses: https://github.com/actions/setup-dotnet@v3 + with: + dotnet-version: 7.0 + - name: Install dependencies + run: | + dotnet restore + echo "::add-path::$HOME/.dotnet/tools" + - name: Setup Dependency Track Dependencies + run: | + dotnet tool install --global CycloneDX + - name: Generate SBOM + run: | + docker sbom --format cyclonedx-json --output bom.json forge.rainote.dev/Wonderking/Continuity:latest + - name: Upload SBOM + uses: https://github.com/DependencyTrack/gh-upload-sbom@v2.0.1 + with: + apiKey: ${{ secrets.DEPENDENCY_TRACK_API_KEY }} + serverHostname: ${{ secrets.DEPENDENCY_TRACK_URL }} + projectName: "${{ secrets.DEPENDENCY_TRACK_PROJECT_NAME }}-container" + autoCreate: true + # set projectversion to be the branch name + projectVersion: "${{ github.ref_name }}" + bomFilename: "${{ github.workspace }}/bom.xml"