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: | |
| - 'v*' | |
| 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: | |
| fetch-depth: 0 # Need to fetch all for proper history | |
| - name: Collect build info | |
| id: info | |
| run: | | |
| # Get short SHA | |
| SHA_SHORT=$(git rev-parse --short HEAD) | |
| echo "sha_short=$SHA_SHORT" >> $GITHUB_OUTPUT | |
| # Extract version from csproj | |
| VERSION=$(grep -oP '(?<=<Version>)[^<]+' RenderiteHook/RenderiteHook.csproj) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version found: $VERSION" | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "9.0.x" | |
| - name: Install Cake Tool | |
| run: dotnet tool restore | |
| - name: Build with Cake | |
| run: dotnet cake --target=Build --verbosity=normal | |
| - name: Create Git Tag (if needed) | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| run: | | |
| TAG_NAME="v${{ steps.info.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 [email protected] | |
| git tag -a "$TAG_NAME" -m "Release $TAG_NAME" | |
| git push origin "$TAG_NAME" | |
| fi | |
| - name: Create GitHub Release | |
| if: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (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: v${{ steps.info.outputs.version }} | |
| tag_name: v${{ steps.info.outputs.version }} | |
| target_commitish: ${{ github.sha }} | |
| files: | | |
| ./RenderiteHook/bin/Release/*.dll | |
| ./build/*.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |