Skip to content

Commit

Permalink
fix: migrate to github action
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanho committed Mar 28, 2023
1 parent d06264c commit 8840647
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 49 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{steps.release.outputs.release_created}}
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: simple
package-name: Postal.AspNetCore

build:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
strategy:
matrix:
dotnet-version: ["3.1.x", "6.0.x"]
steps:
- uses: actions/checkout@v3
- name: Setup dotnet ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Display dotnet version
run: dotnet --version
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release Postal.sln
- name: Test
run: dotnet test -c Release
- name: Upload dotnet test results
uses: actions/upload-artifact@v3
with:
name: dotnet-results-${{ matrix.dotnet-version }}
path: TestResults-${{ matrix.dotnet-version }}
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}

deploy:
runs-on: ubuntu-latest
needs: [build, release-please]
if: ${{ needs.release-please.outputs.release_created }}
strategy:
matrix:
dest: ["myget", "github"]
source-url:
[
"https://www.myget.org/F/herman-github/api/v2/package",
"https://nuget.pkg.github.com/hermanho/index.json",
]
include:
- dest: myget
nuget-auth-token-secret: NUGET_API_KEY
- org: github
nuget-auth-token-secret: GITHUB_TOKEN
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
source-url: ${{ matrix.source-url }}
env:
NUGET_AUTH_TOKEN: ${{ secrets[matrix.nuget-auth-token-secret] }}
- name: Display dotnet version
run: dotnet --version
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release Postal.sln
- name: Create the package
run: dotnet pack src/Postal.AspNetCore/Postal.AspNetCore.csproj -c Release
- name: Publish the package to GPR
run: dotnet nuget push src/Postal.AspNetCore/bin/Release/*.nupkg
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/travis-deploy.sh

This file was deleted.

1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.0

0 comments on commit 8840647

Please sign in to comment.