Trim produced assemblies #314
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: 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: ubuntu-latest | |
timeout-minutes: 10 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Install .NET | |
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 | |
with: | |
dotnet-version: 8.0.x | |
- name: Verify formatting | |
run: > | |
dotnet build | |
-t:CSharpierFormat | |
--configuration Release | |
pack: | |
strategy: | |
matrix: | |
rid: | |
- win-arm64 | |
- win-x86 | |
- win-x64 | |
- linux-x64 | |
- osx-arm64 | |
- osx-x64 | |
runs-on: ${{ startsWith(matrix.rid, 'win-') && 'windows-latest' || startsWith(matrix.rid, 'osx-') && 'macos-latest' || 'ubuntu-latest' }} | |
timeout-minutes: 10 | |
permissions: | |
actions: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Install .NET | |
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 | |
with: | |
dotnet-version: 8.0.x | |
- name: Publish app | |
run: > | |
dotnet publish YoutubeDownloader | |
-p:Version=${{ github.ref_type == 'tag' && github.ref_name || format('999.9.9-ci-{0}', github.sha) }} | |
-p:CSharpier_Bypass=true | |
--output YoutubeDownloader/bin/publish | |
--configuration Release | |
--runtime ${{ matrix.rid }} | |
--self-contained | |
- name: Upload artifacts | |
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 | |
with: | |
name: YoutubeDownloader.${{ matrix.rid }} | |
path: YoutubeDownloader/bin/publish | |
if-no-files-found: error | |
release: | |
if: ${{ github.ref_type == 'tag' }} | |
needs: | |
- format | |
- 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: | |
rid: | |
- win-arm64 | |
- win-x86 | |
- win-x64 | |
- linux-x64 | |
- osx-arm64 | |
- osx-x64 | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
permissions: | |
actions: read | |
contents: write | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 | |
with: | |
name: YoutubeDownloader.${{ matrix.rid }} | |
path: YoutubeDownloader/ | |
- name: Set permissions | |
if: ${{ !startsWith(matrix.rid, 'win') }} | |
run: | | |
chmod +x YoutubeDownloader/YoutubeDownloader | |
chmod +x YoutubeDownloader/ffmpeg | |
- name: Create package | |
# Change into the artifacts directory to avoid including the directory itself in the zip archive | |
working-directory: YoutubeDownloader/ | |
run: zip -r ../YoutubeDownloader.${{ matrix.rid }}.zip . | |
- name: Upload release asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: > | |
gh release upload ${{ github.ref_name }} | |
YoutubeDownloader.${{ matrix.rid }}.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 |