-
Notifications
You must be signed in to change notification settings - Fork 1
149 lines (129 loc) · 4.43 KB
/
common-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
name: Changeset and Releace Project Portal
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
id-token: write
contents: write
issues: write
pull-requests: write
jobs:
changesets:
name: Creat Realease Pull-Request
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changesets.outputs.published }}
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git user (trigger actor)
uses: ./.github/actions/config-git-user
- name: Setup node and install deps
uses: ./.github/actions/node-setup
with:
versions: 21.x
- name: install
run: yarn
shell: bash
- name: Create Release Pull Request
id: changesets
uses: changesets/action@v1
with:
title: "Fusion Project Portal Release"
createGithubReleases: true
setupGitUser: false
version: yarn changeset:version
publish: yarn changeset:tag
env:
GITHUB_TOKEN: ${{ github.token }}
- name: convert Changeset PR to draf
if: steps.changesets.outputs.published == 'false' && steps.changesets.outputs.pullRequestNumber
run: gh pr ready ${{ steps.changesets.outputs.pullRequestNumber }} --undo
env:
GH_TOKEN: ${{ github.token }}
release:
name: Production Release Project Portal
needs: changesets
environment: production
runs-on: ubuntu-latest
if: needs.changesets.outputs.published == 'true'
env:
TENANT_ID: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0
CLIENT_ID: ea425507-0de4-4f5f-bac8-48cea54f7a0c
steps:
- name: Install jq
uses: dcarbone/[email protected]
with:
version: "1.6"
- name: "Az CLI login" # uses federated auth
uses: azure/login@v1
with:
tenant-id: ${{env.TENANT_ID}}
client-id: ${{env.CLIENT_ID}}
allow-no-subscriptions: true
- name: "Get Azure principal token for Radix"
run: |
token=$(az account get-access-token --resource 6dae42f8-4368-4678-94ff-3960e28e3630 --query=accessToken -otsv)
echo "::add-mask::$token"
echo "APP_SERVICE_ACCOUNT_TOKEN=$token" >> $GITHUB_ENV
- name: "Get application information for fusion-project-portal"
id: get_application_info_api
uses: equinor/radix-github-actions@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
args: >
get application
--application fusion-project-portal
- name: "Get active deployments from test"
id: get_active_deployments
run: |
activeDeploymentApi=$(echo '${{steps.get_application_info_api.outputs.result}}' | jq -r '.environments | .[] | select(.name=="test") | .activeDeployment.name')
echo "activeDeploymentApi=$activeDeploymentApi" >> "$GITHUB_OUTPUT"
- name: "Promote fusion-project-portal in Radix from test to production"
uses: equinor/radix-github-actions@v1
with:
args: >
create job
promote
-a fusion-project-portal
-d portal
-f
--from-environment test
--to-environment prod
--deployment ${{ steps.get_active_deployments.outputs.activeDeploymentApi }}
releas-admin:
name: Production Release Portal Administartion Application
needs: changesets
environment: production
runs-on: ubuntu-latest
if: needs.changesets.outputs.published == 'true'
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "20"
- name: Get fusion token
id: "get-fusion-token"
uses: ./.github/actions/get-fusion-token
with:
client-id: ${{secrets.AZURE_SP_FUSION}}
tenant-id: ${{secrets.AZURE_TENANT_ID}}
resource-id: ${{secrets.AZURE_FUSION_SCOPE}}
- name: Install
run: |
cd client/apps/portal-administration
yarn install
npm i -g @equinor/fusion-framework-cli
npm i -g typescript
- name: Deploy
run: |
cd client/apps/portal-administration
fusion-framework-cli app build-publish -e fprd