Merge pull request #61 from atc-net/dependabot/nuget/src/Atc.Cosmos/S… #58
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: "Post-Integration" | |
on: | |
push: | |
branches: | |
- main | |
- '!stable' | |
- '!release' | |
env: | |
ATC_EMAIL: 'atcnet.org@gmail.com' | |
ATC_NAME: 'Atc-Net' | |
NUGET_REPO_URL: 'https://nuget.pkg.github.com/atc-net/index.json' | |
VERSION: 1.1.0.${{ github.run_number }} | |
jobs: | |
merge-to-stable: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛒 Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT_WORKFLOWS }} | |
- name: ⚛️ Sets environment variables - branch-name | |
uses: nelonoel/branch-name@v1.0.1 | |
- name: ⚛️ Sets environment variables - Nerdbank.GitVersioning | |
uses: dotnet/nbgv@master | |
with: | |
setAllVars: true | |
- name: ⚙️ Setup dotnet 8.0.x | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' | |
- name: ⚙️ Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
- name: 🧹 Clean | |
run: dotnet clean -c Release && dotnet nuget locals all --clear | |
- name: 🛠️ Building library in release mode | |
run: dotnet pack -c Release -o packages -p:UseSourceLink=true -p:Version=${{ env.VERSION }} -p:PackageVersion=${{ env.VERSION }} | |
- name: 🛠️ Building preview library in release mode | |
run: dotnet pack -c Release -o packages -p:UseSourceLink=true -p:Version=${{ env.VERSION }} -p:PackageVersion=${{ env.VERSION }}-preview -p:DefineConstants=PREVIEW | |
- name: 🧪 Run unit tests | |
run: dotnet test -c Release -p:DefineConstants=PREVIEW | |
- name: 🌩️ SonarCloud install scanner | |
run: dotnet tool install --global dotnet-sonarscanner | |
- name: 🌩️ SonarCloud analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
shell: pwsh | |
continue-on-error: true | |
run: | | |
dotnet sonarscanner begin /k:"atc-cosmos" /o:"atc-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" | |
dotnet build -c Release /p:UseSourceLink=true --no-restore | |
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
- name: ⏩ Merge to stable-branch | |
run: | | |
git config --local user.email ${{ env.ATC_EMAIL }} | |
git config --local user.name ${{ env.ATC_NAME }} | |
git checkout stable | |
git merge --ff-only main | |
git push origin stable | |
- name: 📦 Push packages to GitHub Package Registry | |
continue-on-error: true | |
run: dotnet nuget push **/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s ${{ env.NUGET_REPO_URL }} --skip-duplicate --no-symbols | |
- name: 🗳️ Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Packages | |
path: | | |
packages/*.nupkg | |
README.md |