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: Build & Publish CS2MenuManager | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'README.md' | |
| - '.github/workflows/**' | |
| - 'config.toml' | |
| - 'images/**' | |
| jobs: | |
| setup: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| outputs: | |
| buildnumber: ${{ steps.buildnumber.outputs.build_number }} | |
| steps: | |
| - name: Generate build number | |
| id: buildnumber | |
| uses: onyxmueller/build-tag-number@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| build: | |
| needs: setup | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Prepare Environment Variables | |
| shell: bash | |
| run: | | |
| echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
| echo "BUILD_NUMBER=${{ needs.setup.outputs.buildnumber }}" >> $GITHUB_ENV | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Restore Dependencies | |
| run: dotnet restore | |
| - name: Build and Pack NuGet Package | |
| run: | | |
| dotnet build CS2MenuManager.sln -c Release --no-restore /p:Version=1.0.${{ env.BUILD_NUMBER }} | |
| dotnet pack CS2MenuManager/CS2MenuManager.csproj -c Release --no-build --output ./nupkg /p:Version=1.0.${{ env.BUILD_NUMBER }} | |
| - name: Check Artifacts | |
| run: | | |
| echo "Listing contents of nupkg directory" | |
| ls -la ./nupkg/ | |
| - name: Publish to NuGet | |
| run: | | |
| dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY_CS2MENUMANAGER }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| - name: Create Release Artifact (ZIP) from BuildOutput | |
| run: | | |
| mkdir -p release | |
| cd BuildOutput | |
| # Create zip, excluding .nupkg and .xml files | |
| zip -r ../CS2MenuManager-v${{ env.BUILD_NUMBER }}.zip * --exclude '*.nupkg' '*.xml' | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v1.0.${{ env.BUILD_NUMBER }} | |
| release_name: v1.0.${{ env.BUILD_NUMBER }} | |
| draft: false | |
| prerelease: false | |
| body: | | |
| ## Release Notes for v1.0.${{ env.BUILD_NUMBER }} | |
| --- | |
| ### Changes: | |
| - ${{ github.event.head_commit.message }} | |
| --- | |
| ### Feedback: | |
| - If you encounter any issues, please report them [here](https://github.com/${{ github.repository }}/issues). | |
| --- | |
| ### Support: | |
| If you'd like to support the continued development of this project, you can do so by [buying me a coffee](https://buymeacoffee.com/schwarper). Your support is genuinely appreciated. | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./CS2MenuManager-v${{ env.BUILD_NUMBER }}.zip | |
| asset_name: CS2MenuManager-v${{ env.BUILD_NUMBER }}.zip | |
| asset_content_type: application/zip |