Skip to content

Fix deploy job

Fix deploy job #168

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:
pack:
runs-on: windows-latest
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: 7.0.x
- name: Publish app
run: >
dotnet publish YoutubeDownloader
--output YoutubeDownloader/bin/publish
--configuration Release
- name: Upload artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # 3.1.3
with:
name: YoutubeDownloader
path: YoutubeDownloader/bin/publish
deploy:
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
needs: pack
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # 3.0.2
with:
name: YoutubeDownloader
path: YoutubeDownloader/
- 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.zip .
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh release create "${{ github.ref_name }}"
"YoutubeDownloader.zip"
--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@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 }}** v${{ github.ref_name }} has been released!\n🔗 [Download](<${{ github.event.repository.html_url }}/releases/tag/${{ github.ref_name }}>) • [Changelog](<${{ github.event.repository.html_url }}/blob/${{ github.ref_name }}/Changelog.md>)"
}
retry-count: 5