Skip to content

Commit

Permalink
Updated git workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
clibequilibrium committed Oct 21, 2023
1 parent c7eb588 commit c1857c7
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bindgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: "bindgen-cs"
path: "./src/cs/production/Tracy/PInvoke.gen.cs"
path: "./src/cs/production/Tracy/Generated"
6 changes: 3 additions & 3 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
uses: actions/download-artifact@v1
with:
name: "bindgen-cs"
path: "./src/cs/production/Tracy"
path: "./src/cs/production/Tracy/Generated"

- name: "Add + commit + push (if necessary)"
uses: EndBug/add-and-commit@v7
with:
author_name: 'lithiumtoast'
author_email: 'lithiumtoast@users.noreply.github.com'
author_name: 'clibequilibrium'
author_email: 'clibequilibrium@users.noreply.github.com'
message: "Update C# bindings"
File renamed without changes.
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "Release"
on:
workflow_dispatch:
inputs:
pre-release:
description: 'Is this a release candidate (pre-release)? (NOTE: candidates get uploaded to MyGet.org instead of NuGet.org)'
required: true
default: 'true'
schedule:
- cron: "0 0 1 * *" # First day of every month

jobs:

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

release-job:
name: "Release"
needs: [build-job]
runs-on: ubuntu-latest
permissions:
contents: write
steps:

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

- name: "Set version"
id: set-version
shell: bash
run: |
IS_PRERELEASE="${{ github.event.inputs.pre-release }}"
if [[ "$IS_PRERELEASE" = "true" ]]; then
VERSION="$(date +'%Y.%m.%d')-rc"
else
VERSION="$(date +'%Y.%m.%d')"
fi
echo "VERSION=$VERSION"
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- 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="${{ steps.set-version.outputs.VERSION }}" -p:RepositoryBranch="${{ github.head_ref || github.ref_name }}" -p:RepositoryCommit="${{ github.sha }}"

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

- name: "Upload packages to NuGet"
if: github.event_name == 'schedule' || github.event.inputs.pre-release == 'false'
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

- name: "Create tag and GitHub release"
uses: softprops/action-gh-release@v1
if: github.event_name == 'schedule' || github.event.inputs.pre-release == 'false'
with:
generate_release_notes: true
prerelease: "{{ github.event.inputs.pre-release == 'true' }}"
tag_name: "v${{ steps.set-version.outputs.VERSION }}"

2 changes: 1 addition & 1 deletion bindgen/config-generate-cs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"inputFilePath": "./x-ast/ast-cross-platform.json",
"outputFilePath": "./PInvoke.gen.cs",
"outputFileDirectory": "./../src/cs/production/Tracy/Generated",
"namespaceName": "Tracy",
"className": "PInvoke",
"libraryName": "TracyClient",
Expand Down

0 comments on commit c1857c7

Please sign in to comment.