Skip to content

Commit

Permalink
Update GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lithiumtoast committed Aug 6, 2023
1 parent 194c2e5 commit b528cf2
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 13 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/bindgen.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Bindgen"

on:
workflow_dispatch:
workflow_call:

jobs:
Expand All @@ -14,7 +15,7 @@ jobs:
platform:
- { name: Windows, os: windows-latest, rid: win }
- { name: macOS, os: macos-latest, rid: osx }
- { name: Linux, os: ubuntu-20.04, rid: linux }
- { name: Linux, os: ubuntu-latest, rid: linux }

steps:
- name: "Clone Git repository"
Expand All @@ -28,7 +29,7 @@ jobs:

- name: "Read C code: Linux dependencies"
if: runner.os == 'Linux'
run: sudo apt-get install gcc-aarch64-linux-gnu
run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu

- name: "Read C code: extract ${{ matrix.platform.rid }}"
shell: bash
Expand Down Expand Up @@ -112,4 +113,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: "bindgen-cs"
path: "./src/cs/production/ImGui/PInvoke.gen.cs"
path: "./src/cs/production/Interop.ImGui/PInvoke.gen.cs"
21 changes: 14 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Build .NET solution"
name: "Build"

on:
workflow_dispatch:
workflow_call:
push:
tags:
Expand Down Expand Up @@ -29,16 +30,20 @@ jobs:
with:
submodules: "recursive"

- name: "Install C2CS"
shell: bash
run: dotnet tool install --global bottlenoselabs.C2CS.Tool

- name: "Get C2CS version"
shell: bash
run: echo "C2CS_VERSION=$(c2cs --version)" >> $GITHUB_ENV

- name: "Cache native libraries"
id: cache-libs
uses: actions/cache@v3
with:
path: "./lib"
key: "libs-${{ matrix.platform.rid }}-${{ hashFiles('ext/cimgui/**/*') }}-${{ hashFiles('src/c/**/*') }}"

- name: "Install C2CS"
shell: bash
run: dotnet tool install --global bottlenoselabs.C2CS.Tool
key: "libs-${{ matrix.platform.rid }}-${{ hashFiles('ext/cimgui/**/*') }}-${{ hashFiles('src/c/**/*') }}-${{ hashFiles('bindgen/**/*') }}-${{ env.C2CS_VERSION }}"

- name: "Build native libraries"
if: steps.cache-libs.outputs.cache-hit != 'true'
Expand All @@ -59,6 +64,8 @@ jobs:

- name: "Clone Git repository"
uses: actions/checkout@master
with:
submodules: 'true'

- name: "Download native libraries (win-x64)"
uses: actions/download-artifact@v1
Expand Down Expand Up @@ -86,5 +93,5 @@ jobs:
path: "./src/cs/production/ImGui"

- name: ".NET Build"
run: dotnet build "./src/cs"
run: dotnet build "./src/cs" --nologo --verbosity minimal --configuration Release -p:PackageVersion="$(date +'%Y.%m.%d')"

6 changes: 3 additions & 3 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Commit generated C# code"
name: "Commit generated code"

on:
workflow_call:
Expand All @@ -22,11 +22,11 @@ jobs:
uses: actions/download-artifact@v1
with:
name: "bindgen-cs"
path: "./src/cs/production/ImGui"
path: "./src/cs/production/Interop.ImGui"

- name: "Add + commit + push (if necessary)"
uses: EndBug/add-and-commit@v7
with:
author_name: 'lithiumtoast'
author_email: '[email protected]'
author_email: '519592+[email protected]'
message: "Update C# bindings"
File renamed without changes.
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "Release"
on:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *" # First day of every month

jobs:

build-job:
name: "Build"
uses: "./.github/workflows/build.yml"

release-job:
name: "Release .NET solution"
needs: [build-job]
runs-on: ubuntu-latest
steps:

- name: "Clone Git repository"
uses: actions/checkout@master
with:
submodules: "recursive"

- name: "Download native libraries (win-x64)"
uses: actions/download-artifact@v1
with:
name: "native-libraries-win-x64"
path: "./lib"

- name: "Download native libraries (osx)"
uses: actions/download-artifact@v1
with:
name: "native-libraries-osx"
path: "./lib"

- name: "Download native libraries (linux-x64)"
uses: actions/download-artifact@v1
with:
name: "native-libraries-linux-x64"
path: "./lib"

- name: ".NET pack"
run: dotnet pack "./src/cs" --nologo --verbosity minimal --configuration Release -p:PackageVersion="$(date +'%Y.%m.%d')" -p:RepositoryBranch="${{ github.head_ref || github.ref_name }}" -p:RepositoryCommit="${{ github.sha }}"

- name: "Upload packages to MyGet"
if: github.event_name == 'workflow_dispatch'
env:
MYGET_ACCESS_TOKEN: ${{ secrets.MYGET_ACCESS_TOKEN }}
run: dotnet nuget push "./nupkg/**/*.nupkg" --source https://www.myget.org/F/bottlenoselabs/api/v3/index.json --skip-duplicate --api-key $MYGET_ACCESS_TOKEN

- name: "Upload packages to NuGet"
if: github.event_name == 'schedule'
env:
NUGET_ACCESS_TOKEN: ${{ secrets.NUGET_ACCESS_TOKEN }}
run: dotnet nuget push "./nupkg/**/*.nupkg" --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key $NUGET_ACCESS_TOKEN

0 comments on commit b528cf2

Please sign in to comment.