Skip to content

[CI] Build ready to run containers #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: DevSpaceAgent publish

on:
push:
paths:
- 'DevSpaceAgent/**'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.x
9.x

- name: Restore dependencies
run: dotnet restore "DevSpaceAgent/DevSpaceAgent.csproj" -r linux-x64

- name: Build
run: dotnet build "DevSpaceAgent/DevSpaceAgent.csproj" --no-restore -r linux-x64 -c Release

- name: Publish
if: github.ref == 'refs/heads/master'
run: dotnet publish "DevSpaceAgent/DevSpaceAgent.csproj" --no-build -r linux-x64 -c Release /p:PublishProfile=Github
36 changes: 36 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: DevSpaceWeb publish

on:
push:
paths:
- 'DevSpaceWeb/**'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x

- name: Restore dependencies
run: dotnet restore "DevSpaceWeb/DevSpaceWeb.csproj" -r linux-x64

- name: Build
run: dotnet build "DevSpaceWeb/DevSpaceWeb.csproj" --no-restore -r linux-x64 -c Release

- name: Publish
if: github.ref == 'refs/heads/master'
run: dotnet publish "DevSpaceWeb/DevSpaceWeb.csproj" --no-build -r linux-x64 -c Release /p:PublishProfile=Github
17 changes: 11 additions & 6 deletions DevSpaceAgent/DevSpaceAgent.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<PublishTrimmed>False</PublishTrimmed>
<PublishAot>False</PublishAot>
<Company>Fluxpoint Development</Company>
<Authors>Builderb</Authors>
<DebugType>embedded</DebugType>
<Version>1.0.15</Version>
<DebugType>embedded</DebugType>
<Version>1.0.15</Version>
<IsPublishable>True</IsPublishable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Docker.DotNet" Version="3.125.15" />
<PackageReference Include="Ductus.FluentDocker" Version="2.10.59" />
<PackageReference Include="NetCoreServer" Version="8.0.7" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="YamlDotNet" Version="16.3.0" />

<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand All @@ -30,5 +36,4 @@
<ItemGroup>
<Folder Include="Services\" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions DevSpaceAgent/Properties/PublishProfiles/Github.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project>
<PropertyGroup>
<ContainerRepository>Misha-133/DevSpace/Agent</ContainerRepository>

<ContainerBaseImage>mcr.microsoft.com/dotnet/runtime:8.0-alpine</ContainerBaseImage>
<EnableSdkContainerSupport>true</EnableSdkContainerSupport>
<WebPublishMethod>Container</WebPublishMethod>
<ContainerRegistry>ghcr.io</ContainerRegistry>
</PropertyGroup>

<ItemGroup>
<ContainerPort Include="5555" Type="tcp" />

<ContainerLabel Include="org.opencontainers.image.source" Value="https://github.com/Misha-133/DevSpace" />
</ItemGroup>
</Project>
14 changes: 7 additions & 7 deletions DevSpaceWeb/DevSpaceWeb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
<CompressionEnabled>false</CompressionEnabled>
</PropertyGroup>

<ItemGroup>
<Content Remove="appsettings.Development.json" />
<Content Remove="appsettings.json" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AspNet.Security.OAuth.Apple" Version="9.0.0" />
<PackageReference Include="AspNet.Security.OAuth.Discord" Version="9.0.0" />
Expand Down Expand Up @@ -51,7 +46,12 @@
</ItemGroup>

<ItemGroup>
<None Include="appsettings.Development.json" />
<None Include="appsettings.json" />
<Content Remove="appsettings.Development.json" />
<Content Remove="appsettings.json" />
</ItemGroup>

<ItemGroup>
<None Include="appsettings.Development.json" />
<None Include="appsettings.json" />
</ItemGroup>
</Project>
16 changes: 16 additions & 0 deletions DevSpaceWeb/Properties/PublishProfiles/Github.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project>
<PropertyGroup>
<ContainerRepository>Misha-133/DevSpace/Web</ContainerRepository>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this change where the package is published to?

Copy link
Author

@Misha-133 Misha-133 Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct. You can't just push to some arbitrary repository tho, as you are limited by GITHUB_TOKENs scope


<ContainerBaseImage>mcr.microsoft.com/dotnet/aspnet:9.0-alpine</ContainerBaseImage>
<EnableSdkContainerSupport>true</EnableSdkContainerSupport>
<WebPublishMethod>Container</WebPublishMethod>
<ContainerRegistry>ghcr.io</ContainerRegistry>
</PropertyGroup>

<ItemGroup>
<ContainerPort Include="5556" Type="tcp" />

<ContainerLabel Include="org.opencontainers.image.source" Value="https://github.com/Misha-133/DevSpace" />
</ItemGroup>
</Project>