Skip to content

Update push.yml

Update push.yml #23

Workflow file for this run

name: Push
on:
push:
branches: [ develop ]
workflow_dispatch:
inputs:
logLevel:
description: "Log level"
required: true
default: "warning"
type: choice
options:
- info
- warning
- debug
permissions:
contents: read
jobs:
build:
environment: github-pages
continue-on-error: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x
- name: Test
run: dotnet test VkNet.Tests/VkNet.Tests.csproj -c Release -f net7.0
- name: Create file status_job1.txt and write the job status into it
if: always()
run: |
echo ${{ job.status }} > status_job1.txt
- name: Upload file status_job1.txt as an artifact
if: always()
uses: actions/upload-artifact@v1
with:
name: pass_status_job1
path: status_job1.txt
nuget:
environment: github-pages
runs-on: ubuntu-latest
needs: build
if: needs.build.result == 'success'
steps:
- uses: actions/checkout@v3
- name: Set up .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x
- uses: bbonkr/get-version-action@v1
id: get_version
with:
project: 'VkNet/VkNet.csproj'
- name: Build Alpha
if: contains(steps.get_version.outputs.version, 'alpha')
run: dotnet build VkNet/VkNet.csproj --configuration Release /p:Version=${{ format('{0}.{1}', steps.get_version.outputs.version, github.run_number) }}
- name: Build Release
if: success() && !contains(steps.get_version.outputs.version, 'alpha')
run: dotnet build VkNet/VkNet.csproj --configuration Release
- name: Build the NuGet package Alpha
if: contains(steps.get_version.outputs.version, 'alpha')
run: dotnet pack VkNet/VkNet.csproj --configuration Release --output ${{env.DOTNET_ROOT}}/Package /p:Version=${{ format('{0}.{1}', steps.get_version.outputs.version, github.run_number) }}
- name: Build the NuGet package Release
if: success() && !contains(steps.get_version.outputs.version, 'alpha')
run: dotnet pack VkNet/VkNet.csproj --configuration Release --output ${{env.DOTNET_ROOT}}/Package
- name: Publish NuGet Package
run: dotnet nuget push ${{env.DOTNET_ROOT}}/Package/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
telegram:
environment: github-pages
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [build, nuget]
steps:
- name: Download artifact pass_status_job1
uses: actions/download-artifact@v1
with:
name: pass_status_job1
- name: Set the statuses of Job 1 as output parameters
id: set_outputs
run: |
echo "::set-output name=status_job1::$(<pass_status_job1/status_job1.txt)"
- id: string
uses: Panuchi/[email protected]
with:
string: ${{ steps.set_outputs.outputs.status_job1 }}
- name: Send Telegram notification
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: 'html'
disable_web_page_preview: true
message: |
<b>${{ steps.string.outputs.result }}</b>
<code>Reason: ${{ github.event_name }} Build №: ${{ github.run_number }}</code>
<b>Build queued by: ${{ github.triggering_actor }}</b>
https://github.com/${{ github.repository }}/commit/${{github.sha}}