asdadsasd #24
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 | |
| strategy: | |
| matrix: | |
| sm-version: [ '1.12' ] | |
| name: "Build for SM ${{ matrix.sm-version }}" | |
| if: github.ref_type == 'tag' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup SP | |
| uses: rumblefrog/setup-sp@master | |
| with: | |
| version: ${{ matrix.sm-version }} | |
| - name: Download ripext dependency | |
| shell: bash | |
| run: | | |
| # Mac zip just because it's smaller & we don't repack the extensions... | |
| wget https://github.com/ErikMinekus/sm-ripext/releases/download/1.3.1/sm-ripext-1.3.1-mac.zip | |
| unzip sm-ripext-1.3.1-mac.zip "addons/sourcemod/scripting/include/*" | |
| - name: Run compiler | |
| shell: bash | |
| run: | | |
| cd addons/sourcemod | |
| mkdir -p plugins | |
| for src in $(find scripting -maxdepth 1 -type f -name "*.sp"); | |
| do | |
| spcomp $src -o=plugins/$(basename $src .sp)'.smx' -i=scripting/include -v2 | |
| done | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: offstyle-database-${{ github.head_ref || github.ref_name }}-sm${{ matrix.sm-version }} | |
| path: | | |
| addons | |
| retention-days: 14 | |
| release: | |
| name: Release | |
| if: github.ref_type == 'tag' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Zip it up | |
| shell: bash | |
| run: | | |
| # Debug: List what we actually have | |
| echo "Current directory contents:" | |
| ls -la | |
| echo "Looking for artifact directories:" | |
| find * -maxdepth 0 -type d 2>/dev/null || echo "No directories found" | |
| artifact_dir=$(find * -maxdepth 0 -type d | head -n 1) | |
| echo "Artifact directory: $artifact_dir" | |
| if [ -n "$artifact_dir" ]; then | |
| echo "Contents of artifact directory:" | |
| ls -la "$artifact_dir" | |
| # Check if addons exists | |
| if [ -d "$artifact_dir/addons" ]; then | |
| echo "Found addons directory, creating zip..." | |
| zip_name="offstyle-database-${{ github.ref_name }}.zip" | |
| cd "$artifact_dir" | |
| zip -rq "../$zip_name" addons/ | |
| cd .. | |
| echo "zip_file=$zip_name" >> $GITHUB_ENV | |
| else | |
| echo "Error: addons directory not found in $artifact_dir" | |
| exit 1 | |
| fi | |
| else | |
| echo "Error: No artifact directory found" | |
| exit 1 | |
| fi | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| current_tag=${{ github.ref_name }} | |
| previous_tag=$(git tag --sort=-version:refname | head -n 2 | tail -n 1 || 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 and extract the zip file | |
| 2. Upload the contents to your server | |
| 3. Restart your server or reload the plugins | |
| ## Files included | |
| - Compiled plugins in \`addons/sourcemod/plugins/\` | |
| - Source files in \`addons/sourcemod/scripting/\`" | |
| else | |
| body="Automated release of Offstyle Database plugin | |
| ## Changes | |
| - Initial release | |
| ## Installation | |
| 1. Download and extract the zip file | |
| 2. Upload the contents to your server | |
| 3. Restart your server or reload the plugins | |
| ## Files included | |
| - Compiled plugins in \`addons/sourcemod/plugins/\` | |
| - Source files in \`addons/sourcemod/scripting/\`" | |
| fi | |
| echo "body<<EOF" >> $GITHUB_OUTPUT | |
| echo "$body" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| id: create_release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| body: ${{ steps.changelog.outputs.body }} | |
| artifacts: "*.zip" | |
| draft: false | |
| prerelease: false | |
| notify: | |
| name: Discord Notification | |
| if: github.ref_type == 'tag' | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Create Discord zip | |
| shell: bash | |
| run: | | |
| # Debug: List what we actually have | |
| echo "Current directory contents:" | |
| ls -la | |
| echo "Looking for artifact directories:" | |
| find * -maxdepth 0 -type d 2>/dev/null || echo "No directories found" | |
| artifact_dir=$(find * -maxdepth 0 -type d | head -n 1) | |
| echo "Artifact directory: $artifact_dir" | |
| if [ -n "$artifact_dir" ]; then | |
| echo "Contents of artifact directory:" | |
| ls -la "$artifact_dir" | |
| # Check if addons exists | |
| if [ -d "$artifact_dir/addons" ]; then | |
| echo "Found addons directory, creating zip..." | |
| zip_name="offstyle-database-${{ github.ref_name }}.zip" | |
| cd "$artifact_dir" | |
| zip -rq "../$zip_name" addons/ | |
| cd .. | |
| echo "zip_file=$zip_name" >> $GITHUB_ENV | |
| else | |
| echo "Error: addons directory not found in $artifact_dir" | |
| exit 1 | |
| fi | |
| else | |
| echo "Error: No artifact directory found" | |
| exit 1 | |
| fi | |
| - name: Get commit list | |
| id: commits | |
| run: | | |
| current_tag=${{ github.ref_name }} | |
| previous_tag=$(git tag --sort=-version:refname | head -n 2 | tail -n 1 || echo "") | |
| if [ -n "$previous_tag" ]; then | |
| commits=$(git log --oneline $previous_tag..$current_tag) | |
| else | |
| commits="Initial release" | |
| fi | |
| echo "list<<EOF" >> $GITHUB_OUTPUT | |
| echo "$commits" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Notify Discord | |
| uses: tsickert/discord-webhook@v7.0.0 | |
| with: | |
| webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| filename: ${{ env.zip_file }} | |
| content: | | |
| ${{ steps.commits.outputs.list }} |