-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into development
- Loading branch information
Showing
5 changed files
with
174 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Dev Deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
branches: | ||
- development | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
deploy-sentry: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 7.x.x | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --no-restore -c Release -p:SentryOrg=sentry -p:SentryProject=ss14-map-server -p:SentryUploadSymbols=true -p:SentryUploadSources=true -p:SentryUrl=https://bugs.tanukij.dev | ||
env: | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
|
||
deploy-container: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
|
||
- name: Docker Login | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: get-net-sdk-project-versions-action | ||
uses: kzrnm/[email protected] | ||
id: get-version | ||
with: | ||
proj-path: SS14.MapServer/SS14.MapServer.csproj | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=development | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
ci-success: | ||
name: Deploy finished | ||
needs: | ||
- deploy-sentry | ||
- deploy-container | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: CI succeeded | ||
run: exit 0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
deploy-sentry: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 7.x.x | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --no-restore -c Release -p:SentryOrg=sentry -p:SentryProject=ss14-map-server -p:SentryUploadSymbols=true -p:SentryUploadSources=true -p:SentryUrl=https://bugs.tanukij.dev | ||
env: | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
|
||
deploy-container: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
|
||
- name: Docker Login | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: get-net-sdk-project-versions-action | ||
uses: kzrnm/[email protected] | ||
id: get-version | ||
with: | ||
proj-path: SS14.MapServer/SS14.MapServer.csproj | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=latest | ||
type=raw,value=${{steps.get-version.outputs.version}} | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
ci-success: | ||
name: Deploy finished | ||
needs: | ||
- deploy-sentry | ||
- deploy-container | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: CI succeeded | ||
run: exit 0 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using LibGit2Sharp; | ||
using LibGit2Sharp.Handlers; | ||
using Serilog; | ||
using SS14.MapServer.BuildRunners; | ||
using SS14.MapServer.Configuration; | ||
|
@@ -38,13 +39,11 @@ public string Sync(string workingDirectory, string? gitRef = null, string? repoU | |
if (!Path.IsPathRooted(repoDirectory)) | ||
repoDirectory = Path.Join(Directory.GetCurrentDirectory(), repoDirectory); | ||
|
||
|
||
if (!Directory.Exists(repoDirectory)) | ||
Clone(repoUrl, repoDirectory, gitRef); | ||
|
||
Pull(repoDirectory, gitRef); | ||
|
||
|
||
return repoDirectory; | ||
} | ||
|
||
|
@@ -96,14 +95,19 @@ private void Pull(string repoDirectory, string gitRef) | |
_log.Debug("Opening repository in: {RepositoryPath}", repoDirectory); | ||
|
||
using var repository = new Repository(repoDirectory); | ||
//Set a dummy identity | ||
_log.Debug("Setting identity"); | ||
repository.Config.Set("user.name", "ss14.mapserver"); | ||
repository.Config.Set("user.email", "[email protected]"); | ||
|
||
_log.Debug("Fetching ref"); | ||
_buildService.Run(repoDirectory, "git", new List<string> { "fetch origin", gitRef }).Wait(); | ||
_buildService.Run(repoDirectory, "git", new List<string> { "fetch -fu origin", gitRef }).Wait(); | ||
|
||
_log.Debug("Checking out {Ref}", StripRef(gitRef)); | ||
Commands.Checkout(repository, StripRef(gitRef)); | ||
|
||
_log.Debug("Pulling latest changes"); | ||
_buildService.Run(repoDirectory, "git", new List<string> { "pull origin HEAD" }).Wait(); | ||
_buildService.Run(repoDirectory, "git", new List<string> { "pull origin HEAD --ff-only" }).Wait(); | ||
|
||
_log.Debug("Updating submodules"); | ||
foreach (var submodule in repository.Submodules) | ||
|