- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from Blazored/move-to-gh-actions
Move to GitHub Actions for CI
Showing
12 changed files
with
266 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
name: Build & Test Main | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
release: | ||
types: [ published ] | ||
|
||
env: | ||
NETCORE_VERSION: '3.1.301' | ||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
PROJECT_NAME: Toast | ||
GITHUB_FEED: https://nuget.pkg.github.com/Blazored/ | ||
GITHUB_USER: chrissainty | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NUGET_FEED: https://api.nuget.org/v3/index.json | ||
NUGET_KEY: ${{ secrets.NUGET_KEY }} | ||
|
||
jobs: | ||
build: | ||
name: Build, test and pack | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup .NET Core ${{ env.NETCORE_VERSION }} | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: ${{ env.NETCORE_VERSION }} | ||
env: | ||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Restore | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build -c Release --no-restore src/Blazored.$PROJECT_NAME/Blazored.$PROJECT_NAME.csproj | ||
|
||
- name: Test | ||
run: dotnet test -c Release | ||
|
||
- name: Pack | ||
run: dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:PackageVersion=$GITHUB_RUN_ID src/Blazored.$PROJECT_NAME/Blazored.$PROJECT_NAME.*proj | ||
|
||
- name: Publish Sample Site | ||
run: dotnet publish -c Release samples/BlazorWebAssembly/BlazorWebAssembly.csproj | ||
|
||
- name: Rewrite base href | ||
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1 | ||
with: | ||
html_path: samples/BlazorWebAssembly/bin/Release/netstandard2.1/publish/wwwroot/index.html | ||
base_href: /${{ env.PROJECT_NAME }}/ | ||
|
||
- name: Deploy to Github Pages | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
with: | ||
ACCESS_TOKEN: $GITHUB_TOKEN | ||
BASE_BRANCH: main # The branch the action should deploy from. | ||
BRANCH: gh-pages # The branch the action should deploy to. | ||
FOLDER: samples/BlazorWebAssembly/bin/Release/netstandard2.1/publish/wwwroot # The folder the action should deploy. | ||
SINGLE_COMMIT: true | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: nupkg | ||
path: ./src/Blazored.${{ env.PROJECT_NAME }}/bin/Release/*.nupkg | ||
prerelease: | ||
needs: build | ||
if: github.event_name != 'release' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download Artifact | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: nupkg | ||
- name: Push to GitHub Feed | ||
run: | | ||
for f in ./nupkg/*.nupkg | ||
do | ||
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED | ||
done | ||
deploy: | ||
needs: build | ||
if: github.event_name == 'release' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: ${{ env.NETCORE_VERSION }} | ||
- name: Create Release NuGet package | ||
run: | | ||
arrTag=(${GITHUB_REF//\// }) | ||
VERSION="${arrTag[2]}" | ||
echo Version: $VERSION | ||
VERSION="${VERSION//v}" | ||
echo Clean Version: $VERSION | ||
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/Blazored.$PROJECT_NAME/Blazored.$PROJECT_NAME.*proj | ||
- name: Push to GitHub Feed | ||
run: | | ||
for f in ./nupkg/*.nupkg | ||
do | ||
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED | ||
done | ||
- name: Push to NuGet Feed | ||
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Build & Test PR | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
PROJECT_NAME: Blazored.Toast | ||
NETCORE_VERSION: '3.1.301' | ||
|
||
jobs: | ||
build: | ||
name: Build and test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setting up .NET Core SDK ${{ env.NETCORE_VERSION }}... | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: ${{ env.NETCORE_VERSION }} | ||
|
||
- name: Restoring packages... | ||
run: dotnet restore | ||
|
||
- name: Building project... | ||
run: dotnet build --configuration Release --no-restore src/$PROJECT_NAME/$PROJECT_NAME.csproj | ||
|
||
- name: Testing... | ||
run: dotnet test --no-restore --verbosity normal |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Release Drafter | |
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
update_release_draft: | ||
|
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Single Page Apps for GitHub Pages</title> | ||
<script type="text/javascript"> | ||
// Single Page Apps for GitHub Pages | ||
// https://github.com/rafrex/spa-github-pages | ||
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License | ||
// ---------------------------------------------------------------------- | ||
// This script takes the current url and converts the path and query | ||
// string into just a query string, and then redirects the browser | ||
// to the new url with only a query string and hash fragment, | ||
// e.g. http://www.foo.tld/one/two?a=b&c=d#qwe, becomes | ||
// http://www.foo.tld/?p=/one/two&q=a=b~and~c=d#qwe | ||
// Note: this 404.html file must be at least 512 bytes for it to work | ||
// with Internet Explorer (it is currently > 512 bytes) | ||
// If you're creating a Project Pages site and NOT using a custom domain, | ||
// then set segmentCount to 1 (enterprise users may need to set it to > 1). | ||
// This way the code will only replace the route part of the path, and not | ||
// the real directory in which the app resides, for example: | ||
// https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes | ||
// https://username.github.io/repo-name/?p=/one/two&q=a=b~and~c=d#qwe | ||
// Otherwise, leave segmentCount as 0. | ||
var segmentCount = 1; | ||
var l = window.location; | ||
l.replace( | ||
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + | ||
l.pathname.split('/').slice(0, 1 + segmentCount).join('/') + '/?p=/' + | ||
l.pathname.slice(1).split('/').slice(segmentCount).join('/').replace(/&/g, '~and~') + | ||
(l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') + | ||
l.hash | ||
); | ||
</script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
Binary file not shown.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.