Skip to content

Commit

Permalink
port GH actions config from main
Browse files Browse the repository at this point in the history
  • Loading branch information
Cytraen committed Dec 3, 2021
1 parent 0c7d11c commit 5d1516c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 33 deletions.
33 changes: 12 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Main PR/push + stable push
name: main PR+push / stable push

on:
push:
Expand All @@ -8,11 +8,9 @@ on:

jobs:
build:

runs-on: ubuntu-latest

env:
dotnet_sdk_version: '5.0.x'
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
TEST_BUNGIE_API_KEY: ${{ secrets.TEST_BUNGIE_API_KEY }}
Expand All @@ -21,34 +19,27 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Get short SHA
uses: benjlevesque/[email protected]
id: short-sha
with:
length: 8
- name: Get version suffix
id: get_suffix
run: echo ::set-output name=SUFFIX::${GITHUB_SHA:0:9}

- name: Setup .NET
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnet_sdk_version }}

- name: Build client
run: dotnet build ./BungieSharper -c Release
dotnet-version: 5.0.x
include-prerelease: false

- name: Pack entities NuGet package
run: dotnet pack ./BungieSharper.Entities -c Release --no-build --output OutputPackage --version-suffix "ci.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}" -p:ContinuousIntegrationBuild=true
run: dotnet pack ./BungieSharper.Entities -c Release --output OutputPackage -p:ContinuousIntegrationBuild=true -p:VersionSuffix=${{ steps.get_suffix.outputs.SUFFIX }}

- name: Pack client NuGet package
run: dotnet pack ./BungieSharper -c Release --no-build --output OutputPackage --version-suffix "ci.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}" -p:ContinuousIntegrationBuild=true
run: dotnet pack ./BungieSharper -c Release --output OutputPackage -p:ContinuousIntegrationBuild=true -p:VersionSuffix=${{ steps.get_suffix.outputs.SUFFIX }}

- name: Upload artifact (nupkg/snupkg)
uses: actions/upload-artifact@v1
with:
name: BungieSharper - ${{ env.SHA }}
name: BungieSharper_${{ steps.get_suffix.outputs.SUFFIX }}
path: OutputPackage

- name: Build test
run: dotnet build ./BungieSharper.Tests -c Release

- name: Run test
run: dotnet test ./BungieSharper.Tests -c Release --no-build --verbosity normal
run: dotnet test ./BungieSharper.Tests -c Release --verbosity normal
22 changes: 10 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest

env:
dotnet_sdk_version: '5.0.x'
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
TEST_BUNGIE_API_KEY: ${{ secrets.TEST_BUNGIE_API_KEY }}
Expand All @@ -22,19 +22,17 @@ jobs:
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}

- name: Setup .NET
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnet_sdk_version }}

- name: Build client
run: dotnet build ./BungieSharper -c Release -p:Version=${{ steps.get_version.outputs.VERSION }}
dotnet-version: 5.0.x
include-prerelease: false

- name: Pack entities NuGet package
run: dotnet pack ./BungieSharper.Entities -c Release --no-build --output Packages -p:ContinuousIntegrationBuild=true -p:Version=${{ steps.get_version.outputs.VERSION }}
run: dotnet pack ./BungieSharper.Entities -c Release --output Packages -p:ContinuousIntegrationBuild=true -p:Version=${{ steps.get_version.outputs.VERSION }}

- name: Pack client NuGet package
run: dotnet pack ./BungieSharper -c Release --no-build --output Packages -p:ContinuousIntegrationBuild=true -p:Version=${{ steps.get_version.outputs.VERSION }}
run: dotnet pack ./BungieSharper -c Release --output Packages -p:ContinuousIntegrationBuild=true -p:Version=${{ steps.get_version.outputs.VERSION }}

- name: Create Release
id: create_release
Expand Down Expand Up @@ -93,16 +91,16 @@ jobs:

- name: Upload entities to NuGet
run: |
dotnet nuget push ./Packages/BungieSharper.Entities.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push ./Packages/BungieSharper.Entities.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
- name: Upload client to NuGet
run: |
dotnet nuget push ./Packages/BungieSharper.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push ./Packages/BungieSharper.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
- name: Upload entities to GitHub Packages
run: |
dotnet nuget push ./Packages/BungieSharper.Entities.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/ashakoor/index.json --skip-duplicate
dotnet nuget push ./Packages/BungieSharper.Entities.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/ashakoor/index.json
- name: Upload client to GitHub Packages
run: |
dotnet nuget push ./Packages/BungieSharper.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/ashakoor/index.json --skip-duplicate
dotnet nuget push ./Packages/BungieSharper.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/ashakoor/index.json

0 comments on commit 5d1516c

Please sign in to comment.