Merge pull request #141 from Katarina-E/main #24
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 cs2-store | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'README.md' | |
| - '.github/workflows/**' | |
| - 'config-example.toml' | |
| - 'cs2-store-example.json' | |
| 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 | |
| run: | | |
| dotnet build cs2-store.sln -c Release --no-restore /p:Version=${{ env.BUILD_NUMBER }} | |
| - name: Create Release Artifact (ZIP) from BuildOutput | |
| run: | | |
| mkdir -p release | |
| cd BuildOutput | |
| zip -r ../cs2-store-v${{ env.BUILD_NUMBER }}-${{ env.GITHUB_SHA_SHORT }}.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: v${{ env.BUILD_NUMBER }} | |
| release_name: v${{ env.BUILD_NUMBER }} | |
| draft: false | |
| prerelease: false | |
| body: | | |
| ## Release Notes for v${{ env.BUILD_NUMBER }} | |
| --- | |
| ### Changes: | |
| - ${{ github.event.pull_request.title || 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: ./cs2-store-v${{ env.BUILD_NUMBER }}-${{ env.GITHUB_SHA_SHORT }}.zip | |
| asset_name: cs2-store-v${{ env.BUILD_NUMBER }}-${{ env.GITHUB_SHA_SHORT }}.zip | |
| asset_content_type: application/zip |