Build & Release #9
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 & Release | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Set up MSBuild | |
| uses: microsoft/setup-msbuild@v1 | |
| - name: Build solution | |
| run: msbuild cs2-external-esp.sln /p:Configuration=Release | |
| - name: Prepare artifacts | |
| run: | | |
| mkdir release | |
| xcopy x64\Release\* release\ /E /I /Y | |
| copy README.md release\README.md | |
| copy LICENSE release\LICENSE | |
| - name: Archive artifacts | |
| run: | | |
| powershell Compress-Archive -Path release\* -DestinationPath release.zip | |
| - name: Generate tag | |
| id: tag | |
| run: echo "tag=release-${{ github.run_number }}" >> $env:GITHUB_OUTPUT | |
| - name: Create and push tag | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git tag ${{ steps.tag.outputs.tag }} | |
| git push origin ${{ steps.tag.outputs.tag }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Generate changelog | |
| run: | | |
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "HEAD") | |
| REPO_OWNER="${{ github.repository_owner }}" | |
| REPO_NAME="${{ github.event.repository.name }}" | |
| RUN_ID="${{ github.run_id }}" | |
| echo "# Changelog" > CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "## [Unreleased]" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "### 📋 Overview" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "This build has been generated by the [release workflow](https://github.com/IMXNOOBX/cs2-external-esp/blob/main/.github/workflows/auto_build.yml) with the code published on the repository." >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "> ⚠️ **This is a preview build.** We encourage you to build it yourself from the source code to ensure integrity and transparency." >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "### 📦 Artifacts" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "**[Generated artifacts](https://github.com/$REPO_OWNER/$REPO_NAME/actions/runs/$RUN_ID)**" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "### 📝 Changes since $LAST_TAG" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| git log $LAST_TAG..HEAD --pretty=format:"- %h: %s" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "---" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "### ℹ️ Build Information" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "- **Workflow:** [auto_build.yml](https://github.com/IMXNOOBX/cs2-external-esp/blob/main/.github/workflows/auto_build.yml)" >> CHANGELOG.md | |
| echo "- **Source:** [Repository](https://github.com/$REPO_OWNER/$REPO_NAME)" >> CHANGELOG.md | |
| echo "- **Build ID:** \`$RUN_ID\`" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag }} | |
| name: Release (v${{ github.run_number }}) | |
| files: release.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |