make sure directory exists #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET | |
on: | |
push: | |
branches: [ "main", "development" ] | |
pull_request: | |
branches: [ "main", "development" ] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} # checkout the correct branch name | |
fetch-depth: 0 # fetch the whole repo history | |
- name: Git Version | |
id: version | |
uses: codacy/git-version@2.7.1 | |
with: | |
release-branch: main | |
dev-branch: development | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore FileSyncLibNet | |
- name: Pack | |
run: dotnet pack --no-restore --configuration Release -p:Version=${{ steps.version.outputs.version }} -o nuget FileSyncLibNet | |
- name: Push | |
if: github.ref == 'refs/heads/main' | |
run: dotnet nuget push nuget/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --no-symbols | |
- name: Tag | |
if: github.ref == 'refs/heads/main' | |
run: | | |
git config user.email "noreply@github.com" | |
git config user.name "Github" | |
git tag -a "${{ steps.version.outputs.version }}" -m "Version ${{ steps.version.outputs.version }} released" | |
git push origin "${{ steps.version.outputs.version }}" | |