-
Notifications
You must be signed in to change notification settings - Fork 27
156 lines (139 loc) · 5.1 KB
/
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
149
150
151
152
153
154
155
156
name: Release workflow
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
GHR_PROJECT_REPONAME: ui5-language-assistant
GHR_PROJECT_USERNAME: SAP
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [14.x, 16.x, 18.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # will fetch all history
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
- name: Run build
uses: borales/actions-yarn@v4
with:
cmd: ci # will run `yarn run ci` command
- name: Run SonarCloud scan
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x'
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Upload vsix artifact
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x' && github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: vscode-extension-file
path: ./packages/vscode-ui5-language-assistant/vscode-ui5-language-assistant*.vsix
retention-days: 1
if-no-files-found: error
compliance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
with:
args: --include-submodules lint
version:
# Run version job only on pushes to the main branch. The job depends on completion of the build job.
if: github.repository == 'SAP/ui5-language-assistant' && github.event_name == 'push' && github.ref == 'refs/heads/master'
strategy:
matrix:
os: [ubuntu-latest]
node-version: [14.x]
runs-on: ${{ matrix.os }}
needs: [build, compliance]
outputs:
changes: ${{ steps.changesetVersion.outputs.changes }} # map step output to job output
steps:
- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.ACCESS_PAT }} # needed to auto trigger release job
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
- name: Apply changesets
id: changesetVersion
run: |
echo ::set-output name=changes::$(npm run ci:version 2>&1 | grep -q 'No unreleased changesets found' && echo 'false' || echo 'true')
git status
# Get new version number
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: ./packages/vscode-ui5-language-assistant
# Apply changes and create version tag
- name: Commit and push changes
if: steps.changesetVersion.outputs.changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }}
run: |
echo ${{ steps.package-version.outputs.current-version}}
git config user.name github-actions
git config user.email github-actions@github.com
git status
git add -A
git status
git commit -m "chore: apply latest changesets" --no-verify || echo "No changesets found"
git tag -a "v${{ steps.package-version.outputs.current-version}}" -m "v${{ steps.package-version.outputs.current-version}} release"
git log --pretty=oneline | head -n 10
git push --follow-tags
release:
if: github.repository == 'SAP/ui5-language-assistant' && github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.version.outputs.changes == 'false'
runs-on: [ubuntu-latest]
needs: version
steps:
- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0
# Download vsix artifact
- name: 'make folder'
run: mkdir ./artifacts
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: vscode-extension-file
path: ./artifacts
- name: 'check artifacts'
run: ls ./artifacts -la
# Get new version number
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: ./packages/vscode-ui5-language-assistant
# Publish on GitHub
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }} # A personal access token
CURRENT_RELEASE_VERSION: ${{steps.package-version.outputs.current-version}}
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: false
prerelease: false
name: Release v${{env.CURRENT_RELEASE_VERSION}}
tag: v${{env.CURRENT_RELEASE_VERSION}}
owner: ${{env.GHR_PROJECT_USERNAME}}
repo: ${{env.GHR_PROJECT_REPONAME}}
artifacts: './artifacts/*-${{env.CURRENT_RELEASE_VERSION}}.vsix'