Merge pull request #117 from B3none/fix-config-loading #45
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
name: Build RetakesPlugin | |
on: | |
push: | |
branches: [ "master" ] | |
paths: | |
- '**.cs' | |
- '**.csproj' | |
pull_request: | |
branches: [ "master" ] | |
paths: | |
- '**.cs' | |
- '**.csproj' | |
release: | |
types: | |
- created | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Change directory and build | |
run: | | |
cd RetakesPlugin | |
dotnet build | |
- name: Create output directory | |
run: | | |
mkdir -p output/RetakesPlugin | |
mv ./RetakesPlugin/bin/Debug/net8.0/RetakesPlugin.dll output/RetakesPlugin/ | |
mv ./RetakesPlugin/bin/Debug/net8.0/RetakesPlugin.pdb output/RetakesPlugin/ | |
mv ./RetakesPlugin/map_config output/RetakesPlugin/ | |
mv ./RetakesPlugin/lang output/RetakesPlugin/ | |
- name: Copy output (no map configs) | |
run: | | |
cp -r output/ output-no-map-configs/ | |
rm -rf output-no-map-configs/RetakesPlugin/map_config | |
- name: Publish artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: RetakesPlugin-${{ github.sha }} | |
path: output | |
- name: Publish artifact (no map configs) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: RetakesPlugin-${{ github.sha }}-no-map-configs | |
path: output-no-map-configs | |
release: | |
needs: build | |
permissions: write-all | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: RetakesPlugin-${{ github.sha }} | |
- name: Create release assets | |
run: | | |
zip -r RetakesPlugin-${{ github.sha }}.zip ./RetakesPlugin | |
rm -rf ./RetakesPlugin/map_config | |
zip -r RetakesPlugin-${{ github.sha }}-no-map-configs.zip ./RetakesPlugin | |
- name: Get release info | |
run: | | |
RELEASE_INFO=$(curl -sH 'Accept: application/vnd.github.v3+json' https://api.github.com/repos/${{ github.repository }}/releases) | |
export UPLOAD_URL=$(echo $RELEASE_INFO | jq -r ".[] | select(.tag_name == \"${{ github.event.release.tag_name }}\").upload_url") | |
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.UPLOAD_URL }} | |
asset_path: ./RetakesPlugin-${{ github.sha }}.zip | |
asset_name: "cs2-retakes-${{ github.event.release.tag_name }}.zip" | |
asset_content_type: application/zip | |
- name: Upload release asset (no map configs) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.UPLOAD_URL }} | |
asset_path: ./RetakesPlugin-${{ github.sha }}-no-map-configs.zip | |
asset_name: "cs2-retakes-${{ github.event.release.tag_name }}-no-map-configs.zip" | |
asset_content_type: application/zip |