From 7a2f18de57a5c83f6021bca57593780e054e0bf9 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 12 Jun 2020 19:10:10 +0100 Subject: [PATCH] Add prerelease workflow --- .github/workflows/prereleasenuget.yml | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/prereleasenuget.yml diff --git a/.github/workflows/prereleasenuget.yml b/.github/workflows/prereleasenuget.yml new file mode 100644 index 0000000..4f499aa --- /dev/null +++ b/.github/workflows/prereleasenuget.yml @@ -0,0 +1,48 @@ +name: Publish Pre-Release Nuget + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + +jobs: + build: + name: "Publish Pre-Release Nugets" + env: + ASPNETCORE_ENVIRONMENT: "Production" + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.102 + + - name: Restore Nuget Packages + run: dotnet restore TransactionProcessorACL.sln --source https://api.nuget.org/v3/index.json --source https://www.myget.org/F/transactionprocessing/api/v3/index.json + + - name: Build Code + run: dotnet build TransactionProcessorACL.sln --configuration Release + + - name: Get the last version + id: get_version + run: echo ::set-output name=VERSION::$(git tag --sort=committerdate | tail -1) + + - name: Print Version + id: next_version + run: echo ::set-output name=VERSION::${{ steps.get_version.outputs.VERSION }}-build$GITHUB_RUN_NUMBER + + - name: Build and Publish Nuget Packages + run: | + dotnet pack "TransactionProcessorACL.DataTransferObjects\TransactionProcessorACL.DataTransferObjects.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets + dotnet nuget push Nugets/TransactionProcessorACL.DataTransferObjects.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.MYGET_APIKEY }} --source https://www.myget.org/F/transactionprocessing/api/v2/package + +