-
Notifications
You must be signed in to change notification settings - Fork 20
148 lines (126 loc) · 4.56 KB
/
backstage-release.yaml
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
name: Publish release on NPM
on:
# When manually triggered
workflow_dispatch:
inputs:
releaseName:
description: 'Release name, e.g. v1.2.3'
required: true
# When there's a release created
release:
types: [ published ]
jobs:
publish-release-on-npm:
name: Publish release on NPM
runs-on: ubuntu-latest
steps:
- name: Setup release name
run: |
if [ -z "${{ github.event.release.name }}" ]; then
echo "RELEASE_NAME=${{ github.event.inputs.releaseName }}" >> $GITHUB_ENV
else
echo "RELEASE_NAME=${{ github.event.release.name }}" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'backstage/.nvmrc'
cache: 'yarn'
cache-dependency-path: 'backstage/yarn.lock'
- name: Print environment
run: |
node --version
yarn --version
- name: Print release name
run: |
echo "Release name: ${RELEASE_NAME}"
- name: Install dependencies
shell: bash
working-directory: ./backstage
run: yarn --prefer-offline --frozen-lockfile
- name: lint all code
shell: bash
working-directory: ./backstage
run: yarn backstage-cli repo lint
- name: Install tooling
shell: bash
working-directory: ./backstage
run: npm install @backstage/cli -g
- name: Compile
shell: bash
working-directory: ./backstage
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn tsc
- name: Run tests
shell: bash
working-directory: ./backstage
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn test
- name: Build
shell: bash
working-directory: ./backstage
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn tsc
yarn build:all
- name: Update version of knative-event-mesh-backend plugin
shell: bash
working-directory: ./backstage/plugins/knative-event-mesh-backend
run: |
export PATH="./node_modules/.bin/:$PATH"
export RELEASE_VERSION="${RELEASE_NAME:1}"
yarn version --new-version ${RELEASE_VERSION} --no-git-tag-version
- name: Prepack knative-event-mesh-backend plugin
shell: bash
working-directory: ./backstage/plugins/knative-event-mesh-backend
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn prepack
- name: Publish knative-event-mesh-backend plugin
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
package: backstage/plugins/knative-event-mesh-backend
- name: Postpack knative-event-mesh-backend plugin
shell: bash
working-directory: ./backstage/plugins/knative-event-mesh-backend
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn postpack
- name: Export knative-event-mesh-backend dynamic plugin
shell: bash
working-directory: ./backstage/plugins/knative-event-mesh-backend
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn export-dynamic
- name: Publish knative-event-mesh-backend dynamic plugin
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
package: backstage/plugins/knative-event-mesh-backend/dist-dynamic
- name: Post status to Slack
# Note: using env.SLACK_WEBHOOK here because secrets are not allowed in the if block.
if: ${{ env.SLACK_WEBHOOK != '' && failure()}}
uses: rtCamp/[email protected]
env:
SLACK_ICON: http://github.com/knative.png?size=48
SLACK_USERNAME: knative/release
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: knative-release
MSG_MINIMAL: 'true'
SLACK_TITLE: '${{ github.repository }} release failed'
SLACK_MESSAGE: |
View GitHub Run - https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Fail if NO-GO
if: env.current == 'false'
run: |
# When we have figured out that things are NO-GO, we intentionally fail the job
# so that the status badge shows up red and we can use the badges to create a
# releasability dashboard for all of the repos.
exit 1