Skip to content

Add deploy job

Add deploy job #22

Workflow file for this run

name: main
on:
push:
pull_request:
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@v4
- name: Install .NET
uses: actions/setup-dotnet@v4
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@v4
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Publish app
run: >
dotnet publish SoundCloudDownloader
-p:Version=${{ github.ref_type == 'tag' && github.ref_name || format('999.9.9-ci-{0}', github.sha) }}
-p:CSharpier_Bypass=true
--output SoundCloudDownloader/bin/publish
--configuration Release
--runtime ${{ matrix.rid }}
--self-contained
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: SoundCloudDownloader.${{ matrix.rid }}
path: SoundCloudDownloader/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@v4
with:
name: SoundCloudDownloader.${{ matrix.rid }}
path: SoundCloudDownloader/
- name: Create package
# Change into the artifacts directory to avoid including the directory itself in the zip archive
working-directory: SoundCloudDownloader/
run: zip -r ../SoundCloudDownloader.${{ matrix.rid }}.zip .
- name: Upload release asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh release upload ${{ github.ref_name }}
SoundCloudDownloader.${{ matrix.rid }}.zip
--repo ${{ github.event.repository.full_name }}