1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-27 23:08:35 +01:00

Compare commits

..

3 commits

Author SHA1 Message Date
Ell
cd8b10bd4d actions: fixed env variable names 2024-01-14 22:29:53 +01:00
Ell
6487ad3644 actions: potentially fixed passing ref name xvfb 2024-01-14 22:21:43 +01:00
Ell
dfc56611f2
Switch to GitHub Actions (#15)
* switch to github actions for workflows

* fixed action names

* setup java in build and restore in docs

* use java 17 for android sdk

* clean up restore step
2024-01-14 22:12:07 +01:00
4 changed files with 67 additions and 51 deletions

51
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,51 @@
on: [push, pull_request]
jobs:
build-publish:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Restore tools
run: dotnet tool restore
- name: Run cake
uses: coactions/setup-xvfb@v1
with:
run: dotnet cake --target Publish --branch ${{ github.ref_name }}
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
BAGET_KEY: ${{ secrets.BAGET_KEY }}
docs:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore tools
run: dotnet tool restore
- name: Run cake
run: dotnet cake --target Document --branch $GITHUB_REF_NAME
- name: Deploy
if: github.event_name == 'push' && github.ref_name == 'release'
# this is a beautiful way to deploy a website and i will not take any criticism
run: |
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb
mkdir ~/.ssh && echo "${{ secrets.ELLBOT_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
rsync -rv --delete -e 'ssh -o "ProxyCommand cloudflared access ssh --hostname %h" -o "StrictHostKeyChecking=no"' Docs/_site/. ellbot@ssh.ellpeck.de:/var/www/MLEM

View file

@ -1,16 +0,0 @@
steps:
build:
image: runmymind/docker-android-sdk:ubuntu-standalone
commands:
# install xvfb to allow for graphics-dependent tests
- apt-get update && apt-get install -y --no-install-recommends xauth xvfb openjdk-11-jdk
# install dotnet
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 8.0.100
- export DOTNET_ROOT=$HOME/.dotnet
- export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
# run cake
- dotnet tool restore
- xvfb-run -a dotnet cake --target Publish --branch $CI_COMMIT_BRANCH
secrets:
- nuget_key
- baget_key

View file

@ -1,16 +0,0 @@
steps:
document:
image: mcr.microsoft.com/dotnet/sdk:8.0-jammy
commands:
- dotnet tool restore
- dotnet cake --target Document --branch $CI_COMMIT_BRANCH
deploy:
image: debian:latest
when:
- event: [push, manual]
branch: release
commands:
- rm -rfv /var/www/MLEM/*
- cp -rv Docs/_site/. /var/www/MLEM/
volumes:
- /var/www/MLEM:/var/www/MLEM

View file

@ -14,7 +14,7 @@ Task("Prepare").Does(() => {
DotNetRestore("MLEM.FNA.sln"); DotNetRestore("MLEM.FNA.sln");
if (branch != "release") { if (branch != "release") {
var buildNum = EnvironmentVariable("CI_PIPELINE_NUMBER"); var buildNum = EnvironmentVariable("GITHUB_RUN_NUMBER");
if (!string.IsNullOrEmpty(buildNum)) if (!string.IsNullOrEmpty(buildNum))
version += "-ci." + buildNum; version += "-ci." + buildNum;
} }
@ -52,24 +52,21 @@ Task("Pack").IsDependentOn("Test").Does(() => {
DotNetPack("MLEM.FNA.sln", settings); DotNetPack("MLEM.FNA.sln", settings);
}); });
Task("Push") Task("Push").WithCriteria(branch == "main" || branch == "release", "Not on main or release branch").IsDependentOn("Pack").Does(() => {
.WithCriteria(branch == "main" || branch == "release", "Not on main or release branch") DotNetNuGetPushSettings settings;
.WithCriteria(string.IsNullOrEmpty(EnvironmentVariable("CI_COMMIT_PULL_REQUEST")), "On pull request") if (branch == "release") {
.IsDependentOn("Pack").Does(() => { settings = new DotNetNuGetPushSettings {
DotNetNuGetPushSettings settings; Source = "https://api.nuget.org/v3/index.json",
if (branch == "release") { ApiKey = EnvironmentVariable("NUGET_KEY")
settings = new DotNetNuGetPushSettings { };
Source = "https://api.nuget.org/v3/index.json", } else {
ApiKey = EnvironmentVariable("NUGET_KEY") settings = new DotNetNuGetPushSettings {
}; Source = "https://nuget.ellpeck.de/v3/index.json",
} else { ApiKey = EnvironmentVariable("BAGET_KEY")
settings = new DotNetNuGetPushSettings { };
Source = "https://nuget.ellpeck.de/v3/index.json", }
ApiKey = EnvironmentVariable("BAGET_KEY") settings.SkipDuplicate = true;
}; DotNetNuGetPush("**/MLEM*.nupkg", settings);
}
settings.SkipDuplicate = true;
DotNetNuGetPush("**/MLEM*.nupkg", settings);
}); });
Task("Document").Does(() => { Task("Document").Does(() => {