diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 44ee035..4807093 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -64,80 +64,41 @@ jobs: # Use the .NET SDK from global.json in the root of the repository. global-json-file: global.json # Write version to file so .NET will build correct version. - # - name: Write Version to File - # uses: jacobtomlinson/gha-find-replace@v3 - # with: - # find: "0.0.0-devbuild" - # replace: ${{ steps.next-version.outputs.version }} - # regex: false - # include: GodotHelper/GodotHelper.csproj - - # - name: Build - # working-directory: GodotHelper - # run: dotnet build -c Release - - # - name: Get Package Path - # id: package-path - # run: | - # package=$(find ./GodotHelper/nupkg -name "*.nupkg") - # echo "package=$package" >> "$GITHUB_OUTPUT" - # echo "Found package: $package" - # echo "${{ steps.package-path.outputs.package }}" - - # # - name: Create Release - # # run: | - # # version="${{ steps.next-version.outputs.version }}" - - # # curl -X POST "http://192.168.1.4:3000/api/packages/Ronnie/GodotHelpers/releases" \ - # # -H "Authorization: token ${{ secrets.GH_BASIC }}" \ - # # -H "Content-Type: application/json" \ - # # -d "{ - # # \"tag_name\": \"$version\", - # # \"name\": \"v$version\", - # # \"body\": \"Auto release $version\" - # # }" - # - name: Publish to Nuget - # run: | - # dotnet nuget push "${{ steps.package-path.outputs.package }}" \ - # --source "gitea:3000/api/packages/Ronnie/nuget/index.json" \ - # --allow-insecure-connections \ - # --api-key "${{ secrets.NUGET_KEY }}" \ - # --skip-duplicate - - - name: Setup .NET - uses: actions/setup-dotnet@v4 + - name: Write Version to File + uses: jacobtomlinson/gha-find-replace@v3 with: - dotnet-version: 10.0.x + find: "0.0.0-devbuild" + replace: ${{ steps.next-version.outputs.version }} + regex: false + include: GodotHelper/GodotHelper.csproj - - name: Restore - run: dotnet restore - - name: Calculate Version - id: version - run: | - TAG=$(git describe --tags --abbrev=0) - COMMITS=$(git rev-list $TAG..HEAD --count) - - BASE=${TAG#v} - - IFS='.' read MAJOR MINOR PATCH <<< "$BASE" - - NEW_PATCH=$((PATCH + COMMITS)) - - VERSION="$MAJOR.$MINOR.$NEW_PATCH" - - echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - name: Build + working-directory: GodotHelper run: dotnet build -c Release - - name: Pack + - name: Get Package Path + id: package-path run: | - dotnet pack \ - -p:PackageVersion=${{ steps.version.outputs.VERSION }} \ - -c Release + package=$(find ./GodotHelper/nupkg -name "*.nupkg") + echo "package=$package" >> "$GITHUB_OUTPUT" + echo "Found package: $package" + echo "${{ steps.package-path.outputs.package }}" - - name: Publish + - name: Create Release run: | - dotnet nuget push ./bin/Release/*.nupkg \ + version="${{ steps.next-version.outputs.version }}" + + curl -X POST "http://192.168.1.4:3000/api/packages/Ronnie/GodotHelpers/releases" \ + -H "Authorization: token ${{ secrets.GH_BASIC }}" \ + -H "Content-Type: application/json" \ + -d "{ + \"tag_name\": \"$version\", + \"name\": \"v$version\", + \"body\": \"Auto release $version\" + }" + - name: Publish to Nuget + run: | + dotnet nuget push "${{ steps.package-path.outputs.package }}" \ --source "http://192.168.1.4:3000/api/packages/Ronnie/nuget/index.json" \ --allow-insecure-connections \ --api-key "${{ secrets.NUGET_KEY }}" \ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..af061fa --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,104 @@ +name: Build NuGet + +on: + push: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - name: Restore + run: dotnet restore + - name: Calculate Version + id: version + run: | + TAG=$(git describe --tags --abbrev=0) + COMMITS=$(git rev-list $TAG..HEAD --count) + + BASE=${TAG#v} + + IFS='.' read MAJOR MINOR PATCH <<< "$BASE" + + NEW_PATCH=$((PATCH + COMMITS)) + + VERSION="$MAJOR.$MINOR.$NEW_PATCH" + + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + - name: Build + run: dotnet build -c Release + + - name: Pack + run: | + dotnet pack \ + -p:PackageVersion=${{ steps.version.outputs.VERSION }} \ + -c Release + + - name: Publish + run: | + dotnet nuget push GodotHelper/nupkg/*.nupkg \ + --source "http://192.168.1.4:3000/api/packages/Ronnie/nuget/index.json" \ + --allow-insecure-connections \ + --api-key "${{ secrets.NUGET_KEY }}" \ + --skip-duplicate + +# name: Gitea Actions Demo +# run-name: ${{ gitea.actor }} is testing out Gitea Actions +# on: [push] + +# jobs: +# Explore-Gitea-Actions: +# runs-on: ubuntu-latest +# steps: +# - run: echo " The job was automatically triggered by a ${{ gitea.event_name }} event." +# - run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!" +# - run: echo " The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." +# - name: Checkout +# uses: actions/checkout@v3 +# # with: +# # repository: Ronnie/SjkScripts +# # token: ${{ gitea.token }} +# # github-server-url: http://192.168.1.4:3000 +# - run: echo " The ${{ gitea.repository }} repository has been cloned to the runner." +# - run: echo " The workflow is now ready to test your code on the runner." +# - name: List files in the repository +# run: | +# ls ${{ gitea.workspace }} +# - run: echo " This job's status is ${{ job.status }}." +# - run: echo " HELP ME, I'M A GITHUB ACTION." +# - run: echo " HELP ME PLEASE." +# - run: echo " I'M SO TIRED." +# - run: echo " 9999999." +# name: Gitea Actions Demo +# run-name: ${{ gitea.actor }} is testing out Gitea Actions +# on: [push] + +# jobs: +# Explore-Gitea-Actions: +# runs-on: ubuntu-latest +# steps: +# - run: echo " The job was automatically triggered by a ${{ gitea.event_name }} event." +# - run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!" +# - run: echo " The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." +# - name: Check out repository code +# run: | +# git clone http://192.168.1.4:3000/Ronnie/SjkScripts.git +# - run: echo " The ${{ gitea.repository }} repository has been cloned to the runner." +# - run: echo " The workflow is now ready to test your code on the runner." +# - name: List files in the repository +# run: | +# ls ${{ gitea.workspace }} +# - run: echo " This job's status is ${{ job.status }}." +# - run: echo " HELP ME, I'M A GITHUB ACTION." + #e59e39d60f30b539ae594d8cfc7a9771883d2eb0