-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (72 loc) · 2.65 KB
/
main.yml
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
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 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Pass branch and patch number to Nuke OctoVersion
# (for pull_request events we override the /refs/pull/xx/merge branch to the PR's head branch)
env:
OCTOVERSION_CurrentBranch: ${{ github.head_ref || github.ref }}
OCTOVERSION_Patch: ${{ github.run_number }}
AssentNonInteractive: true
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # all
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
# Adjustment is done prior to Nuke build as OCTOVERSION information is included in the result package.
- name: Append OCTOVERSION_CurrentBranch with -nightly (for scheduled)
if: github.event_name == 'schedule'
run: echo "OCTOVERSION_CurrentBranch=${{ env.OCTOVERSION_CurrentBranch }}-nightly" >> $GITHUB_ENV
- name: Nuke Build 🏗
id: build
shell: bash
run: ./build.sh
- name: Tag release (when not pre-release) 🏷️
id: github-tag
if: ${{ github.event_name != 'schedule' && !contains( steps.build.outputs.octoversion_fullsemver, '-' ) }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.build.outputs.octoversion_fullsemver }}",
sha: context.sha
})
- name: Push to Octopus 🐙
uses: OctopusDeploy/push-package-action@v3
with:
server: ${{ secrets.DEPLOY_URL }}
space: Integrations
api_key: ${{ secrets.DEPLOY_API_KEY }}
packages: |
./artifacts/Octopus.Versioning.${{ steps.build.outputs.octoversion_fullsemver }}.nupkg
- name: Create Release in Octopus 🐙
uses: OctopusDeploy/create-release-action@v3
with:
server: ${{ secrets.DEPLOY_URL }}
space: Integrations
api_key: ${{ secrets.DEPLOY_API_KEY }}
project: "Versioning"
packages: |
Octopus.Versioning:${{ steps.build.outputs.octoversion_fullsemver }}