Skip to content

Commit

Permalink
feat: added nuget release action
Browse files Browse the repository at this point in the history
  • Loading branch information
aochmann committed Mar 5, 2021
1 parent def9b55 commit bd86f40
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/release-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: (NuGet) NuGet Release

on:
workflow_run:
workflows: [ "Build" ]
types:
- completed
jobs:
nuget_release:
name: NuGet Release
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
env:
# Nuget Setup
NUGET_VERSION: 'latest'
NUGET_OUTPUT: ${{ github.workspace }}/nuget/
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
NUGET_FEED: https://api.nuget.org/v3/index.json

# Project Setup
PROJECT_NAME: 'Cogworks.Essentials'

steps:
- name: Checkout master
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0

- name: Get version
shell: bash
run: |
tag_check=$(git describe --exact-match `git rev-parse HEAD` | head -1)
echo "VERSION=$tag_check" >> $GITHUB_ENV
- name: Download a single artifact
uses: aochmann/actions-download-artifact@1.0.2
with:
name: build_${{ env.PROJECT_NAME }}.${{ env.VERSION }}
path: ${{ env.NUGET_OUTPUT }}

- name: Configure NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: ${{ env.NUGET_VERSION }}

- name: Push to NuGet Feed
shell: bash
working-directory: ${{ env.NUGET_OUTPUT }}
run: |
for nugetFile in ./*.nupkg
do
nuget push $nugetFile ${{ env.NUGET_TOKEN }} -Source ${{ env.NUGET_FEED }}
done

0 comments on commit bd86f40

Please sign in to comment.