generated from credfeto/cs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (155 loc) · 7.4 KB
/
build-and-publish-release.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: "Build: Release"
on:
push:
branches:
- 'release/*'
- 'hotfix/*'
# Don't cancel anything in progress
concurrency:
group: ${{github.workflow}}-${{github.ref}}-release
cancel-in-progress: false
permissions:
contents: write
security-events: write
jobs:
build-release:
runs-on: ubuntu-latest
env:
REPO_STATUS: ${{vars.REPO_VISIBILITY}}
SQLCOMPARE_VERSION: latest
USE_NUGET_CACHE: ${{vars.USE_NUGET_CACHE}}
steps:
- name: "Initialise Workspace"
if: startsWith(runner.name, 'buildagent-')
shell: bash
run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE"
- name: "Checkout Source"
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
fetch-tags: true
- if: env.USE_NUGET_CACHE == ''
name: "Setup Nuget Cache"
shell: bash
run: echo "USE_NUGET_CACHE=false" >> "$GITHUB_ENV"
- if: startsWith(runner.name, 'buildagent-') != true
name: "Ensure on github agents nuget cache is disabled"
shell: bash
run: echo "USE_NUGET_CACHE=false" >> "$GITHUB_ENV"
- if: env.REPO_STATUS == ''
name: "Check Repo Visibility"
uses: credfeto/action-repo-visibility@v1.2.0
id: visibility
with:
repository: ${{github.repository}}
token: ${{secrets.SOURCE_PUSH_TOKEN}}
- name: "Check Runner details"
uses: actions/github-script@v7.0.1
with:
script: |
core.info('Name: ${{runner.name}}');
core.info('OS: ${{runner.os}}');
- name: "Build and deploy"
if: env.USE_NUGET_CACHE == 'true'
uses: ./.github/actions/build
with:
PRODUCTION_BUILD: True
NPM_PRODUCTION_PACKAGER_VERSION: ${{vars.PRODUCTION_PACKAGER_VERSION}}
NPM_CONTENT_PACKAGE_WALLET_PASSWORD: ${{secrets.CONTENT_PACKAGE_WALLET_PASSWORD}}
NPM_PACKAGE_STORE_SIGNING_WALLET: ${{secrets.PACKAGE_STORE_SIGNING_WALLET}}
NPM_PACKAGE_STORE_SIGNING_WALLET_PASSWORD: ${{secrets.PACKAGE_STORE_SIGNING_WALLET_PASSWORD}}
NPM_REGISTRY: ${{vars.NPM_CACHE}}
NUGET_PUBLIC_RESTORE_FEED_CACHE: ${{vars.NUGET_BAGET_CACHE}}
NUGET_PUBLIC_RESTORE_FEED: ${{vars.NUGET_PUBLIC_RESTORE_FEED}}
NUGET_ADDITIONAL_RESTORE_FEED_RELEASE_CACHE: ${{vars.RELEASE_BAGET_CACHE}}
NUGET_ADDITIONAL_RESTORE_FEED_PRERELEASE_CACHE: ""
NUGET_ADDITIONAL_RESTORE_FEED_RELEASE: ${{vars.NUGET_ADDITIONAL_RESTORE_FEED_RELEASE}}
NUGET_ADDITIONAL_RESTORE_FEED_PRERELEASE: ""
NUGET_PACK: ${{vars.NUGET_PACK}}
NUGET_FEED: ${{secrets.NUGET_FEED}}
NUGET_SYMBOL_FEED: ${{secrets.NUGET_SYMBOL_FEED}}
NUGET_API_KEY: ${{secrets.NUGET_API_KEY}}
SLEET_CONFIG: ${{secrets.SLEET_CONFIG}}
SLEET_FEED: "dotnet-release"
PROJECT_TO_PUBLISH: ${{vars.PROJECT_TO_PUBLISH}}
DOCKER_APP_OWNER: ${{vars.DOCKER_APP_OWNER}}
DOCKER_APP_NAME: ${{vars.DOCKER_APP_NAME}}
CLOUD_FORMATION_DEPLOY: ${{vars.CLOUD_FORMATION_DEPLOY}}
CLOUD_FORMATION_STACK: ${{vars.CLOUD_FORMATION_STACK}}
GITHUB_TOKEN: ${{secrets.SOURCE_PUSH_TOKEN}}
REPO_VISIBILITY: ${{env.REPO_STATUS}}
AWS_ACCESS_KEY_ID: ${{secrets.AWS_DOCKER_CONTAINER_REGISTRY_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_DOCKER_CONTAINER_REGISTRY_SECRET_ACCESS_KEY}}
AWS_REGION: ${{vars.AWS_REGION}}
AWS_CONTAINER_REGISTRY: ${{vars.AWS_CONTAINER_REGISTRY}}
AWS_LOAD_BALANCER_HOSTNAME: ${{vars.AWS_LOAD_BALANCER_HOSTNAME_PROD}}
AWS_LOAD_BALANCER_PRIORITY: ${{vars.AWS_LOAD_BALANCER_PRIORITY_PROD}}
API_HOST: ${{vars.AWS_LOAD_BALANCER_HOSTNAME_DEV}}
API_PREFIX: ${{vars.API_PREFIX}}
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_ACCESS_TOKEN: ${{secrets.DOCKER_ACCESS_TOKEN}}
DOTNET_DOCKER_PLATFORM: ${{vars.DOTNET_DOCKER_PLATFORM}}
DOTNET_CONTAINER_PLATFORM: ${{vars.DOTNET_CONTAINER_PLATFORM}}
SQL_SERVER: ${{vars.SQL_SERVER}}
SQL_DB: ${{vars.SQL_DB}}
SQL_USER: ${{vars.SQL_USER}}
SQL_PASSWORD: ${{secrets.SQL_PASSWORD}}
REDGATE_EMAIL: ${{secrets.REDGATE_EMAIL}}
REDGATE_PAT: ${{secrets.REDGATE_PAT}}
SQLCOMPARE_VERSION: ${{env.SQLCOMPARE_VERSION}}
CREATE_RELEASE: true
- name: "Build and deploy"
if: env.USE_NUGET_CACHE != 'true'
uses: ./.github/actions/build
with:
PRODUCTION_BUILD: True
NPM_PRODUCTION_PACKAGER_VERSION: ${{vars.PRODUCTION_PACKAGER_VERSION}}
NPM_CONTENT_PACKAGE_WALLET_PASSWORD: ${{secrets.CONTENT_PACKAGE_WALLET_PASSWORD}}
NPM_PACKAGE_STORE_SIGNING_WALLET: ${{secrets.PACKAGE_STORE_SIGNING_WALLET}}
NPM_PACKAGE_STORE_SIGNING_WALLET_PASSWORD: ${{secrets.PACKAGE_STORE_SIGNING_WALLET_PASSWORD}}
NPM_REGISTRY: ${{vars.NPM_REGISTRY}}
NUGET_PUBLIC_RESTORE_FEED_CACHE: ""
NUGET_PUBLIC_RESTORE_FEED: ${{vars.NUGET_PUBLIC_RESTORE_FEED}}
NUGET_ADDITIONAL_RESTORE_FEED_RELEASE_CACHE: ${{vars.RELEASE_BAGET_CACHE}}
NUGET_ADDITIONAL_RESTORE_FEED_PRERELEASE_CACHE: ""
NUGET_ADDITIONAL_RESTORE_FEED_RELEASE: ${{vars.NUGET_ADDITIONAL_RESTORE_FEED_RELEASE}}
NUGET_ADDITIONAL_RESTORE_FEED_PRERELEASE: ""
NUGET_PACK: ${{vars.NUGET_PACK}}
NUGET_FEED: ${{secrets.NUGET_FEED}}
NUGET_SYMBOL_FEED: ${{secrets.NUGET_SYMBOL_FEED}}
NUGET_API_KEY: ${{secrets.NUGET_API_KEY}}
SLEET_CONFIG: ${{secrets.SLEET_CONFIG}}
SLEET_FEED: ${{vars.RELEASE_SLEET_FEED}}
PROJECT_TO_PUBLISH: ${{vars.PROJECT_TO_PUBLISH}}
DOCKER_APP_OWNER: ${{vars.PROJECT_TO_PUBLISH}}
DOCKER_APP_NAME: ${{vars.DOCKER_APP_NAME}}
CLOUD_FORMATION_DEPLOY: ${{vars.CLOUD_FORMATION_DEPLOY}}
CLOUD_FORMATION_STACK: ${{vars.CLOUD_FORMATION_STACK}}
GITHUB_TOKEN: ${{secrets.SOURCE_PUSH_TOKEN}}
REPO_VISIBILITY: ${{env.REPO_STATUS}}
AWS_ACCESS_KEY_ID: ${{secrets.AWS_DOCKER_CONTAINER_REGISTRY_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_DOCKER_CONTAINER_REGISTRY_SECRET_ACCESS_KEY}}
AWS_REGION: ${{vars.AWS_REGION}}
AWS_CONTAINER_REGISTRY: ${{vars.AWS_CONTAINER_REGISTRY}}
AWS_LOAD_BALANCER_HOSTNAME: ${{vars.AWS_LOAD_BALANCER_HOSTNAME_PROD}}
AWS_LOAD_BALANCER_PRIORITY: ${{vars.AWS_LOAD_BALANCER_PRIORITY_PROD}}
API_HOST: ${{vars.AWS_LOAD_BALANCER_HOSTNAME_DEV}}
API_PREFIX: ${{vars.API_PREFIX}}
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_ACCESS_TOKEN: ${{secrets.DOCKER_ACCESS_TOKEN}}
DOTNET_DOCKER_PLATFORM: ${{vars.DOTNET_DOCKER_PLATFORM}}
DOTNET_CONTAINER_PLATFORM: ${{vars.DOTNET_CONTAINER_PLATFORM}}
SQL_SERVER: ${{vars.SQL_SERVER}}
SQL_DB: ${{vars.SQL_DB}}
SQL_USER: ${{vars.SQL_USER}}
SQL_PASSWORD: ${{secrets.SQL_PASSWORD}}
REDGATE_EMAIL: ${{secrets.REDGATE_EMAIL}}
REDGATE_PAT: ${{secrets.REDGATE_PAT}}
SQLCOMPARE_VERSION: ${{env.SQLCOMPARE_VERSION}}
CREATE_RELEASE: true
- name: "Build Version"
uses: actions/github-script@v7.0.1
with:
script: |
core.info('Version: \u001b[38;5;6m${{env.BUILD_VERSION}}');
core.notice('Version: ${{env.BUILD_VERSION}}');