Skip to content
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

Switch to GitHub Actions #15

Merged
merged 5 commits into from
Jan 14, 2024
Merged
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
51 changes: 51 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 0 additions & 16 deletions .woodpecker/build.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .woodpecker/docs.yml

This file was deleted.

35 changes: 16 additions & 19 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Task("Prepare").Does(() => {
DotNetRestore("MLEM.FNA.sln");

if (branch != "release") {
var buildNum = EnvironmentVariable("CI_PIPELINE_NUMBER");
var buildNum = EnvironmentVariable("GITHUB_RUN_NUMBER");
if (!string.IsNullOrEmpty(buildNum))
version += "-ci." + buildNum;
}
Expand Down Expand Up @@ -52,24 +52,21 @@ Task("Pack").IsDependentOn("Test").Does(() => {
DotNetPack("MLEM.FNA.sln", settings);
});

Task("Push")
.WithCriteria(branch == "main" || branch == "release", "Not on main or release branch")
.WithCriteria(string.IsNullOrEmpty(EnvironmentVariable("CI_COMMIT_PULL_REQUEST")), "On pull request")
.IsDependentOn("Pack").Does(() => {
DotNetNuGetPushSettings settings;
if (branch == "release") {
settings = new DotNetNuGetPushSettings {
Source = "https://api.nuget.org/v3/index.json",
ApiKey = EnvironmentVariable("NUGET_KEY")
};
} else {
settings = new DotNetNuGetPushSettings {
Source = "https://nuget.ellpeck.de/v3/index.json",
ApiKey = EnvironmentVariable("BAGET_KEY")
};
}
settings.SkipDuplicate = true;
DotNetNuGetPush("**/MLEM*.nupkg", settings);
Task("Push").WithCriteria(branch == "main" || branch == "release", "Not on main or release branch").IsDependentOn("Pack").Does(() => {
DotNetNuGetPushSettings settings;
if (branch == "release") {
settings = new DotNetNuGetPushSettings {
Source = "https://api.nuget.org/v3/index.json",
ApiKey = EnvironmentVariable("NUGET_KEY")
};
} else {
settings = new DotNetNuGetPushSettings {
Source = "https://nuget.ellpeck.de/v3/index.json",
ApiKey = EnvironmentVariable("BAGET_KEY")
};
}
settings.SkipDuplicate = true;
DotNetNuGetPush("**/MLEM*.nupkg", settings);
});

Task("Document").Does(() => {
Expand Down
Loading