test alpha beta #23
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: PugSharp_test_and_build | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
tags: [ v**] | |
paths: | |
- '**' | |
- '!README.md' | |
- '!Makefile' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
- develop | |
- 'feature/**' | |
tags: [ v**] | |
paths: | |
- '**' | |
- '!README.md' | |
- '!Makefile' | |
env: | |
DOTNET_RUNTIME_URL: https://download.visualstudio.microsoft.com/download/pr/dc2c0a53-85a8-4fda-a283-fa28adb5fbe2/8ccade5bc400a5bb40cd9240f003b45c/aspnetcore-runtime-7.0.11-linux-x64.tar.gz | |
DOTNET_RUNTIME_VERSION: 7.0.11 | |
jobs: | |
# test_linux_x64: | |
# runs-on: ubuntu-latest | |
# if: ${{ !startsWith( github.event.pull_request.head.label, 'lan2play-weblate' ) }} | |
# steps: | |
# - name : machine echo github | |
# env : { CONTENT : "${{ toJson(github) }}" } | |
# run : "echo $CONTENT" | |
# - name: Set up JDK 11 | |
# uses: actions/setup-java@v3 | |
# with: | |
# distribution: 'temurin' | |
# java-version: '11' | |
# - name: Setup .NET | |
# uses: actions/setup-dotnet@v3 | |
# with: | |
# dotnet-version: 7.0 | |
# - uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 0 | |
# - name: Cache SonarCloud packages | |
# uses: actions/cache@v3 | |
# with: | |
# path: ./sonar/cache | |
# key: ${{ runner.os }}-sonar | |
# restore-keys: ${{ runner.os }}-sonar | |
# - name: Cache SonarCloud scanner | |
# id: cache-sonar-scanner | |
# uses: actions/cache@v3 | |
# with: | |
# path: ./sonar/scanner | |
# key: ${{ runner.os }}-sonar-scanner | |
# restore-keys: ${{ runner.os }}-sonar-scanner | |
# - name: Install SonarCloud scanner | |
# if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
# shell: pwsh | |
# run: | | |
# New-Item -Path ./sonar/scanner -ItemType Directory | |
# dotnet tool install dotnet-sonarscanner --tool-path ./sonar/scanner | |
# - name: Update SonarCloud scanner | |
# if: steps.cache-sonar-scanner.outputs.cache-hit != 'false' | |
# shell: pwsh | |
# run: | | |
# dotnet tool update dotnet-sonarscanner --tool-path ./sonar/scanner | |
# - name: Restore dependencies | |
# run: dotnet restore | |
# - name: start sonarscanner | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# SONAR_TOKEN: ${{ secrets.PUGSHARP_SONAR_TOKEN }} | |
# run: ./sonar/scanner/dotnet-sonarscanner begin /k:"Lan2Play_PugSharp" /o:"lan2play" /d:sonar.login="${{ secrets.PUGSHARP_SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="./**/*.opencover.xml" | |
# - name: dotnet build | |
# run: dotnet build --no-restore | |
# - name: dotnet test | |
# run: dotnet test --no-build --no-restore --collect "XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover | |
# - name: stop sonarscanner | |
# if: always() | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# SONAR_TOKEN: ${{ secrets.PUGSHARP_SONAR_TOKEN }} | |
# run: ./sonar/scanner/dotnet-sonarscanner end /d:sonar.login="${{ secrets.PUGSHARP_SONAR_TOKEN }}" | |
build_linux_x64: | |
runs-on: ubuntu-latest | |
# if: ${{ !startsWith( github.event.pull_request.head.label, 'lan2play-weblate' ) }} | |
# needs: | |
# - test_linux_x64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: set Version | |
if: ${{ (startsWith(github.ref, 'refs/tags/v')) }} | |
run: echo "PUGSHARPNETVER=$(echo ${GITHUB_REF} | sed 's|refs/heads/||g' | sed 's|refs/tags/v||g' )" >> $GITHUB_ENV | |
- name: set Version | |
if: ${{ !(startsWith(github.ref, 'refs/tags/v')) }} | |
run: echo "PUGSHARPNETVER=0.0.1-alpha" >> $GITHUB_ENV | |
- name: set Pugsharp version | |
run: sed -i "s|0.0.1|$PUGSHARPNETVER|g" PugSharp/PugSharp.cs | |
- name: Build Pugsharp | |
run: dotnet publish | |
- name: cleanup build | |
run: rm -rf PugSharp/bin/Debug/net7.0/publish/CounterStrikeSharp.API.dll | |
- name: prepare package structure | |
run: mkdir -p packagebuild/addons/counterstrikesharp/plugins/PugSharp | |
- name: copy included counterstrikesharp | |
run: cp -rf PugSharp/counterstrikesharp packagebuild/addons/ | |
- name: copy included counterstrikesharp vdf | |
run: cp -rf PugSharp/metamod packagebuild/addons/metamod | |
- name: copy package content | |
run: cp -rf PugSharp/bin/Debug/net7.0/publish/* packagebuild/addons/counterstrikesharp/plugins/PugSharp | |
- name: Add dotnet runtime | |
run: | | |
mkdir -p packagebuild/addons/counterstrikesharp/dotnet | |
curl -s -L $DOTNET_RUNTIME_URL \ | |
| tar xvz -C packagebuild/addons/counterstrikesharp/dotnet | |
mv packagebuild/addons/counterstrikesharp/dotnet/shared/Microsoft.NETCore.App/$DOTNET_RUNTIME_VERSION/* packagebuild/addons/counterstrikesharp/dotnet/shared/Microsoft.NETCore.App/ | |
- name: build package | |
run: zip -r PugSharp_$PUGSHARPNETVER.zip addons | |
working-directory: ./packagebuild | |
- name: move package | |
run: mv PugSharp_$PUGSHARPNETVER.zip ../ | |
working-directory: ./packagebuild | |
- name: replace version variable in meta files | |
run: sed -i "s|%%VERSION%%|$PUGSHARPNETVER|g" ./release.json; | |
- name: replace CounterStrikeSharpVersion variable in meta files | |
run: sed -i "s|%%COUNTERSTRIKESHARPVERSION%%|0.0.1|g" ./release.json; | |
- name: replace CS2VERSION variable in meta files | |
run: sed -i "s|%%CS2VERSION%%|1.39.6.5/13965 9842|g" ./release.json; | |
- name: Release | |
if: ${{ (startsWith(github.ref, 'refs/tags/v')) && !(contains(github.ref, '-beta')) }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
./release.json | |
./packagebuild/PugSharp_*.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: pre Release | |
if: ${{ (startsWith(github.ref, 'refs/tags/v')) && (contains(github.ref, '-beta')) }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
prerelease: true | |
files: | | |
./release.json | |
./PugSharp_*.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: upload pre - pre release | |
uses: actions/upload-artifact@v3 | |
with: | |
name: latest_pre_pre | |
path: | | |
./release.json | |
./PugSharp_*.zip | |
retention-days: 10 |