Allow pack
job to run in parallel to test
#73
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: main | |
on: [push, pull_request] | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
jobs: | |
test: | |
runs-on: windows-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 7.0.x | |
- name: Run tests | |
run: > | |
dotnet test | |
--configuration Release | |
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" | |
--collect:"XPlat Code Coverage" | |
-- | |
RunConfiguration.CollectSourceInformation=true | |
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
pack: | |
runs-on: windows-latest | |
permissions: | |
actions: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 7.0.x | |
- name: Publish | |
run: > | |
dotnet publish LightBulb | |
--output LightBulb/bin/publish/ | |
--configuration Release | |
- name: Create installer | |
shell: pwsh | |
run: | | |
choco install innosetup --no-progress | |
Copy-Item -Path LightBulb/bin/publish/ -Recurse -Destination Installer/Source/ | |
& "c:\Program Files (x86)\Inno Setup 6\ISCC.exe" Installer/Installer.iss | |
- name: Upload artifacts (portable) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: LightBulb | |
path: LightBulb/bin/publish/ | |
- name: Upload artifacts (installer) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: LightBulb-Installer | |
path: Installer/bin/LightBulb-Installer.exe | |
deploy: | |
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} | |
needs: | |
- test | |
- pack | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: write | |
steps: | |
- name: Download artifacts (portable) | |
uses: actions/download-artifact@v3 | |
with: | |
name: LightBulb | |
path: LightBulb | |
- name: Download artifacts (installer) | |
uses: actions/download-artifact@v3 | |
with: | |
name: LightBulb-Installer | |
- name: Create package (portable) | |
shell: pwsh | |
run: > | |
Compress-Archive | |
-Path LightBulb/* | |
-DestinationPath LightBulb.zip | |
-Force | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: > | |
gh release create "${{ github.ref_name }}" | |
"LightBulb.zip" | |
"LightBulb-Installer.exe" | |
--repo "${{ github.event.repository.full_name }}" | |
--title "${{ github.ref_name }}" | |
--notes "[Changelog](${{ github.event.repository.html_url }}/blob/${{ github.ref_name }}/Changelog.md)" | |
--verify-tag | |
notify: | |
needs: deploy | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Notify Discord | |
uses: tyrrrz/action-http-request@v1 | |
with: | |
url: ${{ secrets.DISCORD_WEBHOOK }} | |
method: POST | |
headers: | | |
Content-Type: application/json; charset=UTF-8 | |
body: | | |
{ | |
"avatar_url": "https://raw.githubusercontent.com/${{ github.event.repository.full_name }}/${{ github.ref_name }}/favicon.png", | |
"content": "**${{ github.event.repository.name }}** new version released!\nVersion: `${{ github.ref_name }}`\nChangelog: <${{ github.event.repository.html_url }}/blob/${{ github.ref_name }}/Changelog.md>" | |
} |