This repository has been archived by the owner on May 10, 2023. It is now read-only.
Build, Test, Package and Push #726
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, Test, Package and Push | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on pull request events and merges/pushes to main | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
schedule: | |
# Daily 5am australian/brisbane time | |
- cron: '19 0 * * *' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # all | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Configure GitHub package source π | |
id: package-source | |
shell: bash | |
run: dotnet nuget update source GitHub --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text | |
- name: Nuke Build π | |
id: build | |
env: | |
OCTOVERSION_CurrentBranch: ${{ github.head_ref || github.ref }} # For pull_request events we override the /refs/pull/xx/merge branch to the PR's head branch | |
OCTOVERSION_Patch: ${{ github.run_number }} | |
JiraIntegration_E2E_BaseUrl: ${{ secrets.JIRA_BASE_URL }} | |
JiraIntegration_E2E_Username: ${{ secrets.JIRA_USERNAME }} | |
JiraIntegration_E2E_AuthToken: ${{ secrets.JIRA_AUTH_TOKEN }} | |
shell: bash | |
run: ./build.sh --verbosity verbose | |
- name: Push package to GitHub π | |
id: push-github | |
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.event_name != 'schedule' | |
shell: bash | |
run: dotnet nuget push artifacts/**/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "GitHub" | |
- name: Push package to feed π | |
id: push-feed | |
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.event_name != 'schedule' | |
shell: bash | |
env: | |
FEED_API_KEY: ${{ secrets.FEED_API_KEY }} | |
FEED_SOURCE: ${{ secrets.FEED_SOURCE }} | |
run: dotnet nuget push artifacts/**/*.nupkg --api-key "$FEED_API_KEY" --source "$FEED_SOURCE" | |
- name: GitHub Tag π· | |
id: github-tag | |
uses: actions/github-script@v3 | |
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.event_name != 'schedule' && steps.build.outputs.prerelease_tag == '' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/${{ steps.build.outputs.semver }}", | |
sha: context.sha | |
}) |