Attempt cool looking release message #11
Workflow file for this run
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 and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: 'Tag name for the release' | |
| required: true | |
| default: 'v0.0.1' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Make compile script and compiler executable | |
| run: | | |
| chmod +x compile.sh | |
| chmod +x spcomp spcomp64 | |
| - name: Compile plugin | |
| run: ./compile.sh offstyledb.sp | |
| - name: Check if compiled file exists | |
| run: | | |
| if [ ! -f "./compiled/offstyledb.smx" ]; then | |
| echo "Error: Compiled plugin not found!" | |
| exit 1 | |
| fi | |
| ls -la compiled/ | |
| - name: Get tag name | |
| id: get_tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "tag_name=${{ github.event.inputs.tag_name }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| git fetch --tags | |
| current_tag=${{ steps.get_tag.outputs.tag_name }} | |
| previous_tag=$(git tag --sort=-version:refname | sed -n '2p' || echo "") | |
| if [ -n "$previous_tag" ]; then | |
| commits=$(git log --oneline $previous_tag..$current_tag) | |
| body="Automated release of Offstyle Database plugin | |
| ## Changes | |
| $commits | |
| ## Installation | |
| 1. Download \`offstyledb.smx\` | |
| 2. Upload to your SourceMod plugins directory | |
| 3. Restart your server or use \`sm plugins reload offstyledb\`" | |
| else | |
| body="Automated release of Offstyle Database plugin | |
| ## Changes | |
| - Initial release | |
| ## Installation | |
| 1. Download \`offstyledb.smx\` | |
| 2. Upload to your SourceMod plugins directory | |
| 3. Restart your server or use \`sm plugins reload offstyledb\`" | |
| fi | |
| echo "body<<EOF" >> $GITHUB_OUTPUT | |
| echo "$body" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.get_tag.outputs.tag_name }} | |
| release_name: Release ${{ steps.get_tag.outputs.tag_name }} | |
| body: ${{ steps.changelog.outputs.body }} | |
| draft: false | |
| prerelease: false | |
| - name: Upload Plugin Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./compiled/offstyledb.smx | |
| asset_name: offstyledb.smx | |
| asset_content_type: application/octet-stream |