Consolidate workflows

This commit is contained in:
Oleksii Holub 2022-04-22 02:08:49 +03:00
parent 95fb0eaca4
commit fe0d699d09
4 changed files with 96 additions and 97 deletions

View File

@ -1,68 +0,0 @@
name: CD
on:
push:
tags:
- '*'
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.3
- name: Get release version
id: get-version
uses: dawidd6/action-get-tag@v1
- name: Install .NET
uses: actions/setup-dotnet@v1.7.2
with:
# Fixed version, workaround for https://github.com/dotnet/core/issues/7176
dotnet-version: 6.0.100
- name: Build & publish
run: dotnet publish YoutubeDownloader/ -o YoutubeDownloader/bin/Publish --configuration Release
- name: Pack
run: Compress-Archive -Path YoutubeDownloader/bin/Publish/* -DestinationPath YoutubeDownloader/bin/Publish/Archive.zip -Force
shell: pwsh
- name: Create release
id: create_release
uses: actions/create-release@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
[Changelog](https://github.com/Tyrrrz/YoutubeDownloader/blob/master/Changelog.md)
draft: false
prerelease: false
- name: Upload release asset
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: YoutubeDownloader/bin/Publish/Archive.zip
asset_name: YoutubeDownloader.zip
asset_content_type: application/zip
- name: Notify Discord
uses: satak/webrequest-action@v1.2.4
with:
url: ${{ secrets.DISCORD_WEBHOOK }}
method: POST
headers: |
{
"ContentType": "application/json; charset=UTF-8"
}
payload: |
{
"content": "**YoutubeDownloader** new version released!\nVersion: `${{ steps.get-version.outputs.tag }}`\nChangelog: <https://github.com/Tyrrrz/YoutubeDownloader/blob/${{ steps.get-version.outputs.tag }}/Changelog.md>"
}

View File

@ -1,26 +0,0 @@
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.3
- name: Install .NET
uses: actions/setup-dotnet@v1.7.2
with:
# Fixed version, workaround for https://github.com/dotnet/core/issues/7176
dotnet-version: 6.0.100
- name: Build & publish
run: dotnet publish YoutubeDownloader/ -o YoutubeDownloader/bin/Publish --configuration Release
- name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: YoutubeDownloader
path: YoutubeDownloader/bin/Publish

93
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,93 @@
name: main
on: [push, pull_request]
jobs:
publish:
runs-on: windows-latest
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install .NET
uses: actions/setup-dotnet@v2
with:
# Fixed version, workaround for https://github.com/dotnet/core/issues/7176
dotnet-version: 6.0.100
- name: Publish
run: dotnet publish YoutubeDownloader/ -o YoutubeDownloader/bin/Publish --configuration Release
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: YoutubeDownloader
path: YoutubeDownloader/bin/Publish
deploy:
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
needs: publish
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: YoutubeDownloader
path: YoutubeDownloader
- name: Create package
run: Compress-Archive -Path YoutubeDownloader/* -DestinationPath YoutubeDownloader.zip -Force
shell: pwsh
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
[Changelog](https://github.com/Tyrrrz/YoutubeDownloader/blob/master/Changelog.md)
draft: false
prerelease: false
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: YoutubeDownloader.zip
asset_path: YoutubeDownloader.zip
asset_content_type: application/zip
notify:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Get release version
id: get_version
uses: dawidd6/action-get-tag@v1
- name: Notify Discord
uses: satak/webrequest-action@v1.2.4
with:
url: ${{ secrets.DISCORD_WEBHOOK }}
method: POST
headers: |
{
"ContentType": "application/json; charset=UTF-8"
}
payload: |
{
"content": "**YoutubeDownloader** new version released!\nVersion: `${{ steps.get-version.outputs.tag }}`\nChangelog: <https://github.com/Tyrrrz/YoutubeDownloader/blob/${{ steps.get-version.outputs.tag }}/Changelog.md>"
}

View File

@ -1,7 +1,7 @@
# YoutubeDownloader
[![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://vshymanskyy.github.io/StandWithUkraine)
[![Build](https://img.shields.io/github/workflow/status/Tyrrrz/YoutubeDownloader/CI/master)](https://github.com/Tyrrrz/YoutubeDownloader/actions)
[![Build](https://img.shields.io/github/workflow/status/Tyrrrz/YoutubeDownloader/main/master)](https://github.com/Tyrrrz/YoutubeDownloader/actions)
[![Release](https://img.shields.io/github/release/Tyrrrz/YoutubeDownloader.svg)](https://github.com/Tyrrrz/YoutubeDownloader/releases)
[![Downloads](https://img.shields.io/github/downloads/Tyrrrz/YoutubeDownloader/total.svg)](https://github.com/Tyrrrz/YoutubeDownloader/releases)
[![Discord](https://img.shields.io/discord/869237470565392384?label=discord)](https://discord.gg/2SUWKFnHSm)
@ -30,7 +30,7 @@ To learn more about the war and how you can help, [click here](https://tyrrrz.me
## Download
- 🟢 **[Stable release](https://github.com/Tyrrrz/YoutubeDownloader/releases/latest)**
- 🟠 [CI build](https://github.com/Tyrrrz/YoutubeDownloader/actions?query=workflow%3ACI)
- 🟠 [CI build](https://github.com/Tyrrrz/YoutubeDownloader/actions/workflows/main.yml)
## Features
@ -45,4 +45,4 @@ To learn more about the war and how you can help, [click here](https://tyrrrz.me
![list](.screenshots/list.png)
![single](.screenshots/single.png)
![multiple](.screenshots/multiple.png)
![multiple](.screenshots/multiple.png)