Repository navigation
Build, Test, Package and Push #1517
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 master | |
| branches: | |
| - master | |
| - release/* | |
| tags-ignore: | |
| - '**' | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| 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-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # all | |
| - name: Setup .NET 8 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Test .NET 8 | |
| run: ./build.ps1 -target Test | |
| - name: Windows unit test report | |
| uses: dorny/test-reporter@6e6a65b7a0bd2c9197df7d0ae36ac5cee784230c # v2.0.0 | |
| if: success() || failure() # run this step even if previous step failed | |
| with: | |
| name: Windows unit test results | |
| path: ./TestResults/*.trx | |
| reporter: dotnet-trx | |
| fail-on-error: true | |
| build-release-linux: | |
| needs: test-windows | |
| 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 | |
| - name: Setup .NET 8 | |
| 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: Linux unit test report | |
| uses: dorny/test-reporter@6e6a65b7a0bd2c9197df7d0ae36ac5cee784230c # v2.0.0 | |
| if: success() || failure() # run this step even if previous step failed | |
| with: | |
| name: Linux unit test results | |
| path: ./TestResults/*.trx | |
| reporter: dotnet-trx | |
| fail-on-error: true | |
| - name: Git Tag (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, '/merge')) && (! contains(github.ref, '/dependabot/')) && (! contains(github.ref, 'prettybot/')) | |
| uses: OctopusDeploy/login@v1 | |
| with: | |
| server: ${{ secrets.OCTOPUS_URL }} | |
| service_account_id: 68b2db4c-06d7-4340-af7a-2e3142930c10 | |
| - name: Push to Octopus 🐙 | |
| if: (! contains(github.ref, '/merge')) && (! contains(github.ref, '/dependabot/')) && (! contains(github.ref, 'prettybot/')) | |
| uses: OctopusDeploy/push-package-action@v3 | |
| with: | |
| packages: | | |
| ./artifacts/Octopus.JavaPropertiesParser.${{ steps.build.outputs.octoversion_fullsemver }}.nupkg | |
| - name: Create Release in Octopus 🐙 | |
| if: (! contains(github.ref, '/merge')) && (! contains(github.ref, '/dependabot/')) && (! contains(github.ref, 'prettybot/')) | |
| uses: OctopusDeploy/create-release-action@v3 | |
| with: | |
| project: JavaPropertiesParser | |
| release_number: ${{ steps.build.outputs.octoversion_fullsemver }} | |
| packages: | | |
| Octopus.JavaPropertiesParser:${{ steps.build.outputs.octoversion_fullsemver }} |