Create merge.yml #454
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
name: Build | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_ENVIRONMENT: github | |
ASPNETCORE_ENVIRONMENT: github | |
BUILD_PATH: "${{github.workspace}}/artifacts" | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
tags: | |
- "v*" | |
pull_request: | |
branches: | |
- master | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore Dependencies | |
run: dotnet restore | |
- name: Install Sass | |
run: npm i -g sass | |
- name: Build Solution | |
run: dotnet build --no-restore --configuration Release | |
- name: Create Packages | |
if: success() && github.event_name != 'pull_request' | |
run: dotnet pack --configuration Release --no-build --output "${{env.BUILD_PATH}}/packages" | |
- name: Publish Samples | |
if: success() && github.event_name != 'pull_request' | |
run: dotnet publish ./samples/Sample.ClientSide/Sample.ClientSide.csproj --configuration Release --output "${{env.BUILD_PATH}}/sample" | |
- name: Upload Packages | |
if: success() && github.event_name != 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: "${{env.BUILD_PATH}}/packages" | |
- name: Upload Sample Web Site | |
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: github-pages | |
path: "${{env.BUILD_PATH}}/sample/wwwroot" | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: packages | |
- name: Publish Packages GitHub | |
run: | | |
for package in $(find -name "*.nupkg"); do | |
echo "${0##*/}": Pushing $package... | |
dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate | |
done | |
- name: Publish Packages feedz | |
run: | | |
for package in $(find -name "*.nupkg"); do | |
echo "${0##*/}": Pushing $package... | |
dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate | |
done | |
- name: Publish Packages Nuget | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
for package in $(find -name "*.nupkg"); do | |
echo "${0##*/}": Pushing $package... | |
dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate | |
done | |
pages: | |
runs-on: ubuntu-latest | |
needs: build | |
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) | |
permissions: | |
pages: write | |
id-token: write | |
steps: | |
- name: Deploy Sample | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} |