You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
206 lines
5.4 KiB
206 lines
5.4 KiB
name: main
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- "*"
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
|
DOTNET_NOLOGO: true
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
|
|
|
jobs:
|
|
format:
|
|
runs-on: windows-latest
|
|
timeout-minutes: 10
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # 4.1.0
|
|
|
|
- name: Install .NET
|
|
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # 3.2.0
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
|
|
- name: Verify formatting
|
|
run: >
|
|
dotnet build
|
|
-t:CSharpierFormat
|
|
--configuration Release
|
|
|
|
test:
|
|
# Tests need access to secrets, so we can't run them against PRs because of limited trust
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
|
|
runs-on: windows-latest
|
|
timeout-minutes: 10
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # 4.1.0
|
|
|
|
- name: Install .NET
|
|
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # 3.2.0
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
|
|
- name: Run tests
|
|
env:
|
|
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
|
run: >
|
|
dotnet test
|
|
-p:CSharpier_Bypass=true
|
|
--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@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # 3.1.4
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
pack:
|
|
strategy:
|
|
matrix:
|
|
app:
|
|
- DiscordChatExporter.Cli
|
|
- DiscordChatExporter.Gui
|
|
|
|
runs-on: windows-latest
|
|
timeout-minutes: 10
|
|
|
|
permissions:
|
|
actions: write
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # 4.1.0
|
|
|
|
- name: Install .NET
|
|
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # 3.2.0
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
|
|
- name: Publish app
|
|
run: >
|
|
dotnet publish ${{ matrix.app }}
|
|
-p:Version=${{ github.ref_type == 'tag' && github.ref_name || format('999.9.9-ci-{0}', github.sha) }}
|
|
-p:CSharpier_Bypass=true
|
|
--output ${{ matrix.app }}/bin/publish/
|
|
--configuration Release
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # 3.1.3
|
|
with:
|
|
name: ${{ matrix.app }}
|
|
path: ${{ matrix.app }}/bin/publish/
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
if: ${{ github.ref_type == 'tag' }}
|
|
|
|
needs:
|
|
- format
|
|
- test
|
|
- pack
|
|
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Create release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: >
|
|
gh release create ${{ github.ref_name }}
|
|
--repo ${{ github.event.repository.full_name }}
|
|
--title ${{ github.ref_name }}
|
|
--generate-notes
|
|
--verify-tag
|
|
|
|
deploy:
|
|
needs: release
|
|
|
|
strategy:
|
|
matrix:
|
|
app:
|
|
- DiscordChatExporter.Cli
|
|
- DiscordChatExporter.Gui
|
|
include:
|
|
- app: DiscordChatExporter.Cli
|
|
asset: DiscordChatExporter.Cli
|
|
- app: DiscordChatExporter.Gui
|
|
# GUI asset isn't suffixed, unlike the CLI asset
|
|
asset: DiscordChatExporter
|
|
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
permissions:
|
|
actions: read
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # 3.0.2
|
|
with:
|
|
name: ${{ matrix.app }}
|
|
path: ${{ matrix.app }}/
|
|
|
|
- name: Create package
|
|
# Change into the artifacts directory to avoid including the directory itself in the zip archive
|
|
working-directory: ${{ matrix.app }}/
|
|
run: zip -r ../${{ matrix.asset }}.zip .
|
|
|
|
- name: Upload release asset
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: >
|
|
gh release upload ${{ github.ref_name }}
|
|
${{ matrix.asset }}.zip
|
|
--repo ${{ github.event.repository.full_name }}
|
|
|
|
notify:
|
|
needs: deploy
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Notify Discord
|
|
uses: tyrrrz/action-http-request@64c70c67f5ebc54d4c7ea09cbe3553322778afd5 # 1.1.2
|
|
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 }}**](<${{ github.event.repository.html_url }}>) v${{ github.ref_name }} has been released!"
|
|
}
|
|
retry-count: 5
|