Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

ci: removed pipelines #7

ci: removed pipelines

ci: removed pipelines #7

Workflow file for this run

name: 'Publish'
on:
workflow_dispatch: # To can dispatch manually
push: # First pipeline to run when deploy a new version
branches:
- main
paths:
- "src/**" # Only run when exists changes in source code
env:
SDK_VERSION: '7.0.306'
PACKAGE_PATH: ./src/**/*.nupkg
NUGET_SERVER: https://api.nuget.org/v3/index.json
jobs:
deploy-nuget:
name: "Deploy nuget"
runs-on: 'ubuntu-latest'
if: github.event_name == 'push'
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: "Setup .NET"
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.SDK_VERSION }}
- name: Semantic Release
id: 'semantic-release'
uses: cycjimmy/semantic-release-action@v4.0.0
with:
semantic_version: 21.1.1
extra_plugins: |
semantic-release-plugin-csproj
@semantic-release/changelog
@semantic-release/git
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "New version"
run: |
echo "Published new version: ${{ steps.semantic-release.outputs.new_release_published }}"
echo "New version: ${{ steps.semantic-release.outputs.new_release_version }}"
- name: "Restore dependencies"
if: ${{ steps.semantic-release.outputs.new_release_published == 'true' }}
run: dotnet restore
- name: "Build"
if: ${{ steps.semantic-release.outputs.new_release_published == 'true' }}
run: dotnet build -c Release --no-restore
- name: "Pack"
if: ${{ steps.semantic-release.outputs.new_release_published == 'true' }}
run: dotnet pack -c Release --no-build -p:PackageVersion=${{ steps.semantic-release.outputs.new_release_version }} -p:Version==${{ steps.semantic-release.outputs.new_release_version }}
- name: "Publish nuget"
if: ${{ steps.semantic-release.outputs.new_release_published == 'true' }}
run: dotnet nuget push ${{ env.PACKAGE_PATH }} --api-key ${{ secrets.NUGET_TOKEN }} --source ${{ env.NUGET_SERVER }} --skip-duplicate
# To can dispatch manually when the semantic-release-action is not working or failed
deploy-nuget-manually:
name: "Deploy nuget manually"
runs-on: 'ubuntu-latest'
if: github.event_name == 'workflow_dispatch'
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: "Setup .NET"
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.SDK_VERSION }}
- name: "Restore dependencies"
run: dotnet restore
- name: "Build"
run: dotnet build -c Release --no-restore
- name: "Pack"
run: dotnet pack -c Release --no-build
- name: "Publish nuget"
run: dotnet nuget push ${{ env.PACKAGE_PATH }} --api-key ${{ secrets.NUGET_TOKEN }} --source ${{ env.NUGET_SERVER }} --skip-duplicate