diff --git a/.github/workflows/auto_release.yaml b/.github/workflows/auto_release.yaml index 7639fbc..4afac5d 100644 --- a/.github/workflows/auto_release.yaml +++ b/.github/workflows/auto_release.yaml @@ -1,10 +1,10 @@ # This workflow will run whenever tests finish running. If tests pass, it will # look at the last commit message to see if it contains the phrase -# "chore(deps): update all dependencies". +# "chore(deps)". # # If it finds a commit with that phrase, and the testing workflow has passed, # it will automatically release a new version of the project by running the -# publish workflow. +# release workflow. # # The commit message phrase above is always used by renovatebot when opening # PR's to update dependencies. If you have renovatebot enabled and set to @@ -31,7 +31,10 @@ jobs: should_release: ${{ steps.release.outputs.should_release }} steps: - name: ๐Ÿงพ Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + uses: actions/checkout@v4 + with: + lfs: true + submodules: 'recursive' - name: ๐Ÿง‘โ€๐Ÿ”ฌ Check Test Results id: tests @@ -43,7 +46,7 @@ jobs: run: | message=$(git log -1 --pretty=%B) - if [[ $message == *"chore(deps): update all dependencies"* ]]; then + if [[ $message == *"chore(deps)"* ]]; then echo "changed=true" >> "$GITHUB_OUTPUT" else echo "changed=false" >> "$GITHUB_OUTPUT" @@ -65,11 +68,12 @@ jobs: echo "โœ‹ Not creating a release." fi - release: - uses: './.github/workflows/publish.yaml' + trigger_release: + uses: './.github/workflows/release.yaml' needs: auto_release if: needs.auto_release.outputs.should_release == 'true' secrets: NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + GH_BASIC: ${{ secrets.GH_BASIC }} with: bump: patch diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 5611f4f..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,95 +0,0 @@ -name: '๐Ÿ“ฆ Publish' -on: - workflow_dispatch: - branches: - - main - inputs: - bump: - description: "Version Bump Method" - type: choice - options: - - major - - minor - - patch - required: true - workflow_call: - secrets: - NUGET_API_KEY: - description: "NuGet API Key" - required: true - inputs: - bump: - description: "Version Bump Method" - type: string - required: true - -jobs: - publish: - name: ๐Ÿ“ฆ Publish - runs-on: ubuntu-latest - steps: - - name: ๐Ÿงพ Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - with: - lfs: true - submodules: 'recursive' - - - name: ๐Ÿ”Ž Read Current Project Verson - uses: KageKirin/get-csproj-version@v1.0.0 - id: current-version - with: - file: Chickensoft.GoDotTest/Chickensoft.GoDotTest.csproj - xpath: /Project/PropertyGroup/Version - - - name: ๐Ÿ–จ Print Current Version - run: | - echo "Current Version: ${{ steps.current-version.outputs.version }}" - - - name: ๐Ÿงฎ Compute Next Version - uses: chickensoft-games/next-godot-csproj-version@v1 - id: next-version - with: - project-version: ${{ steps.current-version.outputs.version }} - godot-version: global.json - bump: ${{ inputs.bump }} - - - name: โœจ Print Next Version - run: | - echo "Next Version: ${{ steps.next-version.outputs.version }}" - - - name: ๐Ÿ“ Change Version - uses: vers-one/dotnet-project-version-updater@v1.7 - with: - file: "Chickensoft.GoDotTest/Chickensoft.GoDotTest.csproj" - version: ${{ steps.next-version.outputs.version }} - - - name: โœ๏ธ Commit Changes - run: | - git config user.name "action@github.com" - git config user.email "GitHub Action" - git commit -a -m "chore(version): update version to ${{ steps.next-version.outputs.version }}" - git push - - - name: โœจ Create Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release create --generate-notes "v${{ steps.next-version.outputs.version }}" - - - name: ๐Ÿ’ฝ Setup .NET SDK - uses: actions/setup-dotnet@v4 - with: - # Use the .NET SDK from global.json in the root of the repository. - global-json-file: global.json - - - name: ๐Ÿ“ฆ Publish - run: | - # build the package - dotnet build Chickensoft.GoDotTest/Chickensoft.GoDotTest.csproj -c Release - - # find the built nuget package - nuget_package=$(find . -name "Chickensoft.GoDotTest.*.nupkg") - - echo "๐Ÿ“ฆ Publishing package: $nuget_package" - - # publish the nuget package - dotnet nuget push "$nuget_package" --api-key "${{ secrets.NUGET_API_KEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..390d350 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,98 @@ +name: '๐Ÿ“ฆ Release' +on: + # Make a release whenever the developer wants. + workflow_dispatch: + inputs: + bump: + type: string + description: "major, minor, or patch" + required: true + default: "patch" + # Make a release whenever we're told to by another workflow. + workflow_call: + secrets: + NUGET_API_KEY: + description: "API key for Nuget" + required: true + GH_BASIC: + description: "Personal access token (PAT) for GitHub" + required: true + # Input unifies with the workflow dispatch since it's identical. + inputs: + bump: + type: string + description: "major, minor, or patch" + required: true + default: "patch" +jobs: + release: + name: '๐Ÿ“ฆ Release' + runs-on: ubuntu-latest + env: + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_NOLOGO: true + steps: + - name: ๐Ÿงพ Checkout + uses: actions/checkout@v4 + with: + lfs: true + submodules: 'recursive' + fetch-depth: 0 # So we can get all tags. + + - name: ๐Ÿ”Ž Read Current Project Version + id: current-version + uses: WyriHaximus/github-action-get-previous-tag@v1 + with: + fallback: "0.0.0-devbuild" + + - name: ๐Ÿ–จ Print Current Version + run: | + echo "Current Version: ${{ steps.current-version.outputs.tag }}" + + - name: ๐Ÿงฎ Compute Next Version + uses: chickensoft-games/next-godot-csproj-version@v1 + id: next-version + with: + project-version: ${{ steps.current-version.outputs.tag }} + godot-version: global.json + bump: ${{ inputs.bump }} + + - uses: actions/setup-dotnet@v4 + name: ๐Ÿ’ฝ Setup .NET SDK + with: + # 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: Chickensoft.GoDotTest/Chickensoft.GoDotTest.csproj + + - name: ๐Ÿ“ฆ Build + working-directory: Chickensoft.GoDotTest + run: dotnet build -c Release + + - name: ๐Ÿ”Ž Get Package Path + id: package-path + run: | + package=$(find ./Chickensoft.GoDotTest/nupkg -name "*.nupkg") + echo "package=$package" >> "$GITHUB_OUTPUT" + echo "๐Ÿ“ฆ Found package: $package" + + - name: โœจ Create Release + env: + GITHUB_TOKEN: ${{ secrets.GH_BASIC }} + run: | + version="${{ steps.next-version.outputs.version }}" + gh release create --title "v$version" --generate-notes "$version" \ + "${{ steps.package-path.outputs.package }}" + + - name: ๐Ÿ›œ Publish to Nuget + run: | + dotnet nuget push "${{ steps.package-path.outputs.package }}" \ + --api-key "${{ secrets.NUGET_API_KEY }}" \ + --source "https://api.nuget.org/v3/index.json" --skip-duplicate diff --git a/Chickensoft.GoDotTest/Chickensoft.GoDotTest.csproj b/Chickensoft.GoDotTest/Chickensoft.GoDotTest.csproj index e0880ca..9bc2756 100644 --- a/Chickensoft.GoDotTest/Chickensoft.GoDotTest.csproj +++ b/Chickensoft.GoDotTest/Chickensoft.GoDotTest.csproj @@ -12,7 +12,7 @@ portable Chickensoft.GoDotTest - 1.5.10 + 0.0.0-devbuild C# test runner for Godot. Run tests from the command line, collect code coverage, and debug tests in VSCode. ยฉ 2023 Chickensoft diff --git a/cspell.json b/cspell.json index 19efa83..adb6d4b 100644 --- a/cspell.json +++ b/cspell.json @@ -25,6 +25,7 @@ "contentfiles", "coreclr", "CYGWIN", + "devbuild", "endregion", "Gamedev", "globaltool",