- Fix bot targeting #15
This file contains 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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: Build & Publish | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
PLUGIN_NAME: BasicAdmin | |
jobs: | |
build: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare env | |
shell: bash | |
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet publish --no-restore | |
- name: Clean build directory | |
run: | | |
mkdir -p addons/counterstrikesharp/plugins/${{env.PLUGIN_NAME}} | |
mv BasicAdmin/bin/Debug/net7.0/publish/* addons/counterstrikesharp/plugins/${{env.PLUGIN_NAME}} | |
cd addons/counterstrikesharp/plugins/${{env.PLUGIN_NAME}} | |
rm CounterStrikeSharp.API.dll McMaster.NETCore.Plugins.dll Microsoft.DotNet.PlatformAbstractions.dll Microsoft.Extensions.DependencyModel.dll ${{env.PLUGIN_NAME}}.pdb | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: css-${{env.PLUGIN_NAME}}-${{ env.GITHUB_SHA_SHORT }} | |
path: addons | |
publish: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Prepare env | |
shell: bash | |
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v3 | |
with: | |
name: css-${{env.PLUGIN_NAME}}-${{ env.GITHUB_SHA_SHORT }} | |
path: addons | |
- name: Prepare zip | |
run: | | |
zip -qq -r css-${{env.PLUGIN_NAME}}-${{ env.GITHUB_SHA_SHORT }}.zip * | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.GITHUB_SHA_SHORT }} | |
files: | | |
css-${{env.PLUGIN_NAME}}-${{ env.GITHUB_SHA_SHORT }}.zip | |
body: | | |
${{ github.event.head_commit.message }} |