2.6.0 Preview 1 #184
Workflow file for this run
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: .NET | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: | |
- published | |
env: | |
# Don't make dotnet so needy | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
# NuGet Config | |
NUGET_FEED: https://api.nuget.org/v3/index.json | |
NUGET_KEY: ${{ secrets.NUGET_API_KEY }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
working-directory: SemgusParser | |
- name: Build | |
run: dotnet build --no-restore --configuration Release | |
working-directory: SemgusParser | |
- name: Unit Tests | |
run: dotnet test | |
working-directory: ParserTests | |
- name: Integration Tests | |
working-directory: IntegrationTests | |
run: ./integration.sh | |
publish: | |
runs-on: ubuntu-latest | |
needs: test | |
strategy: | |
matrix: | |
tpm: | |
- linux-x64 | |
- win-x64 | |
- osx-x64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Publish | |
run: dotnet publish -c Release -o ../output/${{ matrix.tpm }} -r ${{ matrix.tpm }} --self-contained true -p:PublishSingleFile=true | |
working-directory: SemgusParser | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: semgus-parser-${{ matrix.tpm }} | |
path: output/${{ matrix.tpm }} | |
pack: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Pack | |
# Notes: substitute '/' with ' ' in ref to create refArray (e.g., 'refs' 'tags' 'v1.2.3' for /refs/tags/v1.2.3) | |
# remove leading 'v' from the tag (e.g., v1.2.3-beta7) | |
run: | | |
refArray=(${GITHUB_REF//\// }) | |
if [ "${refArray[1]}" == "tags" ]; then | |
VERSION="${refArray[2]/v}" | |
else | |
VERSION="0.0.${GITHUB_RUN_ATTEMPT}-r${GITHUB_SHA}" | |
fi | |
dotnet pack -v normal -c Release --include-symbols --include-source -o ./nupkg -p:PackageVersion=${VERSION} -p:SymbolPackageFormat=snupkg | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nupkg | |
path: ./nupkg/*.*nupkg | |
release: | |
runs-on: ubuntu-latest | |
needs: [pack, publish] | |
if: github.event_name == 'release' | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: assets | |
- name: Display Assets | |
run: ls -l -a assets/* | |
- name: Zip Assets | |
run: | | |
mkdir -p release_files | |
for asset_folder in assets/*; do | |
rm -f "${asset_folder}"/*.pdb | |
find "${asset_folder}" -type f ! -name '*.*' -print -exec chmod a+x {} \; | |
zip -j -r "release_files/$(basename ${asset_folder}).zip" "${asset_folder}" | |
done | |
- name: Update Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ github.event.release.name }} | |
files: release_files/*.zip | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [release] | |
if: github.event_name == 'release' | |
steps: | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Download Assets | |
uses: actions/download-artifact@v3 | |
with: | |
name: nupkg | |
path: nupkg | |
- name: Publish to NuGet | |
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY | |