CI build #410
This file contains hidden or 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: | |
| push: | |
| # Triggers the workflow on pull request events and merges/pushes to main | |
| branches: | |
| - main | |
| - release/* | |
| tags-ignore: | |
| - '**' | |
| paths-ignore: | |
| - "README.md" | |
| - ".octopus" | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| paths-ignore: | |
| - "README.md" | |
| - ".octopus" | |
| schedule: | |
| # Daily 5am australian/brisbane time | |
| - cron: '0 19 * * *' | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| env: | |
| OCTOVERSION_CurrentBranch: ${{ github.head_ref || github.ref }} | |
| OCTOPUS_SPACE: "Core Platform" | |
| jobs: | |
| test-build-and-publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required to obtain the ID token from GitHub Actions | |
| contents: write # Read Required to check out code, Write to create Git Tags | |
| checks: write # Required for test-reporter | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # all | |
| - name: Setup NET 8.0 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Append OCTOVERSION_CurrentBranch with -nightly-<timestamp> (for scheduled) | |
| if: github.event_name == 'schedule' | |
| run: | | |
| echo "OCTOVERSION_CurrentBranch=${{ env.OCTOVERSION_CurrentBranch }}-nightly-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | |
| - name: Nuke Build π | |
| id: build | |
| run: ./build.sh --verbosity verbose | |
| - name: Unit test report | |
| uses: dorny/test-reporter@v1 | |
| if: success() || failure() | |
| with: | |
| name: Unit test results | |
| path: ./TestResults/*.trx | |
| reporter: dotnet-trx | |
| fail-on-error: true | |
| - name: Tag release (when not pre-release) π·οΈ | |
| if: ${{ !contains( steps.build.outputs.octoversion_fullsemver, '-' ) }} | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| github.rest.git.createRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "refs/tags/${{ steps.build.outputs.octoversion_fullsemver }}", | |
| sha: context.sha | |
| }) | |
| - name: Login to Octopus Deploy π | |
| if: (! contains(github.ref, '/dependabot/')) && (! contains(github.ref, 'prettybot/')) | |
| uses: OctopusDeploy/login@v1 | |
| with: | |
| server: ${{ secrets.OCTOPUS_URL }} | |
| service_account_id: 5ac61d40-7bf6-475c-bd4d-4bab17b5a139 | |
| - name: Push to Octopus π | |
| uses: OctopusDeploy/push-package-action@v3 | |
| if: (! contains(github.ref, '/dependabot/')) && (! contains(github.ref, 'prettybot/')) | |
| with: | |
| packages: | | |
| ./artifacts/Octopus.OpenFeature.${{ steps.build.outputs.octoversion_fullsemver }}.nupkg | |
| - name: Create Release in Octopus π | |
| uses: OctopusDeploy/create-release-action@v3 | |
| if: (! contains(github.ref, '/dependabot/')) && (! contains(github.ref, 'prettybot/')) | |
| with: | |
| project: 'OpenFeature Dotnet Provider' | |
| packages: | | |
| Octopus.OpenFeature:${{ steps.build.outputs.octoversion_fullsemver }} |