Release #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| inputs: | |
| create_release: | |
| description: 'Create a GitHub release' | |
| required: false | |
| default: 'true' | |
| type: choice | |
| options: | |
| - 'true' | |
| - 'false' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| - name: Set short sha | |
| id: info | |
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| - uses: kzrnm/get-net-sdk-project-versions-action@v2 | |
| id: get-version | |
| with: | |
| proj-path: BepInEx.AutoPlugin/BepInEx.AutoPlugin.csproj | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.x | |
| - name: Run the Cake script | |
| uses: cake-build/cake-action@v1 | |
| with: | |
| verbosity: Diagnostic | |
| arguments: | | |
| --skip-ci-version=true | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: BepInEx.AutoPlugin-${{ steps.get-version.outputs.version }}-${{ steps.info.outputs.sha_short }} | |
| path: | | |
| artifacts/package/release/*.nupkg | |
| artifacts/bin/BepInEx.AutoPlugin/release/BepInEx.AutoPlugin.dll | |
| - name: Create Git Tag (if needed) | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| run: | | |
| TAG_NAME="${{ steps.get-version.outputs.version }}" | |
| # Check if tag already exists | |
| if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then | |
| echo "Tag $TAG_NAME already exists" | |
| else | |
| echo "Creating tag $TAG_NAME" | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git tag -a "$TAG_NAME" -m "Release $TAG_NAME" | |
| git push origin "$TAG_NAME" | |
| fi | |
| - name: Push NuGet package | |
| run: | | |
| dotnet nuget push artifacts/package/release/*.nupkg --source ${{ secrets.NUGET_SOURCE }} --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate | |
| - name: Create GitHub Release | |
| if: ${{ (github.ref_type == 'tag') || (github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true') }} | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| prerelease: false | |
| generate_release_notes: false | |
| name: ${{ steps.get-version.outputs.version }} | |
| tag_name: ${{ steps.get-version.outputs.version }} | |
| target_commitish: ${{ github.sha }} | |
| files: | | |
| ./artifacts/package/release/*.nupkg | |
| ./artifacts/bin/BepInEx.AutoPlugin/release/BepInEx.AutoPlugin.dll | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |