Merge pull request #63 from cake-contrib/Jericho-patch-1 #77
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: CI/CD | |
on: | |
push: | |
branches: [ "*", "*/*" ] | |
pull_request: | |
branches: [ main,development ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
branch: ${{ steps.cake_build.outputs.branch }} | |
steps: | |
- uses: actions/checkout@v2 | |
- run: git fetch --unshallow | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
include-prerelease: false | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '5.8.1' | |
includePrerelease: true | |
- name: cake build | |
id: cake_build | |
run: | | |
# make file runnable, might not be necessary | |
chmod +x "${GITHUB_WORKSPACE}/build.sh" | |
# run build script | |
"${GITHUB_WORKSPACE}/build.sh" | |
# output branch name | |
echo "::set-output name=branch::$(echo ${GITHUB_REF#refs/heads/})" | |
deploy-dev: | |
runs-on: ubuntu-latest | |
environment: dev | |
needs: build | |
if: ${{ needs.build.outputs.branch == 'development' }} | |
steps: | |
- uses: actions/checkout@v2 | |
- run: git fetch --unshallow | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
include-prerelease: false | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '5.8.1' | |
includePrerelease: true | |
- name: cake deploy | |
run: | | |
# make file runnable, might not be necessary | |
chmod +x "${GITHUB_WORKSPACE}/build.sh" | |
# run deploy script | |
"${GITHUB_WORKSPACE}/build.sh" -t Deploy | |
env: | |
FEED_URL: '${{ secrets.FEED_URL }}' # MyGetFeed | |
FEED_API_KEY: '${{ secrets.FEED_API_KEY }}' | |
REPO_URL: '${{ github.server_url }}/${{ github.repository }}' | |
deploy-prod: | |
runs-on: ubuntu-latest | |
environment: prod | |
needs: build | |
if: ${{ needs.build.outputs.branch == 'main' }} | |
steps: | |
- uses: actions/checkout@v2 | |
- run: git fetch --unshallow | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
include-prerelease: false | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '5.8.1' | |
includePrerelease: true | |
- name: cake deploy | |
run: | | |
# make file runnable, might not be necessary | |
chmod +x "${GITHUB_WORKSPACE}/build.sh" | |
# run script | |
"${GITHUB_WORKSPACE}/build.sh" -t Deploy | |
env: | |
FEED_URL: 'https://api.nuget.org/v3/index.json' # Nuget.org | |
FEED_API_KEY: '${{ secrets.FEED_API_KEY }}' | |
REPO_URL: '${{ github.server_url }}/${{ github.repository }}' | |