-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (92 loc) · 3.91 KB
/
Copy pathmain.yml
File metadata and controls
106 lines (92 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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:
- main
- release/*
tags-ignore:
- '**'
pull_request:
types: [opened, synchronize, reopened]
schedule:
# Daily 5am australian/brisbane time
- cron: '0 19 * * *'
workflow_dispatch:
# Allows you to run this workflow manually from the Actions tab
env:
OCTOVERSION_CurrentBranch: ${{ github.head_ref || github.ref }}
OCTOPUS_SPACE: Integrations
jobs:
build:
name: "Build, Test and Publish" # Branch protections required check matches against this
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:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
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
- name: Publish Test Results
uses: dorny/test-reporter@890a17cecf52a379fc869ab770a71657660be727 # v2.1.0
if: success() || failure() # run this step even if previous step failed
with:
name: Test Results
path: ./source/Octopus.Versioning.Tests/TestResults/*.trx
reporter: dotnet-trx
fail-on-error: true
- name: Git Tag (when not pre-release) 🏷️
id: github-tag
if: ${{ !contains( steps.build.outputs.octoversion_fullsemver, '-' ) }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.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: https://deploy.octopus.app
service_account_id: c6e32234-4fff-4813-b6be-7b1047b717f0
- name: Push build information to Octopus Deploy 🐙
uses: OctopusDeploy/push-build-information-action@v3
if: (! contains(github.ref, '/merge')) && (! contains(github.ref, '/dependabot/')) && (! contains(github.ref, 'prettybot/'))
with:
packages: |
Octopus.Versioning.${{ steps.build.outputs.octoversion_fullsemver }}
version: ${{ steps.build.outputs.octoversion_fullsemver }}
- name: Push Packages to Octopus Deploy 🐙
uses: OctopusDeploy/push-package-action@v3
if: (! contains(github.ref, '/merge')) && (! contains(github.ref, '/dependabot/')) && (! contains(github.ref, 'prettybot/'))
with:
packages: |
./artifacts/Octopus.Versioning.${{ steps.build.outputs.octoversion_fullsemver }}.nupkg
- name: Create Octopus Release 🐙
uses: OctopusDeploy/create-release-action@v3
if: (! contains(github.ref, '/merge')) && (! contains(github.ref, '/dependabot/')) && (! contains(github.ref, 'prettybot/'))
with:
project: Versioning
release_number: ${{ steps.build.outputs.octoversion_fullsemver }}
packages: |
Octopus.Versioning:${{ steps.build.outputs.octoversion_fullsemver }}