-
Notifications
You must be signed in to change notification settings - Fork 10
156 lines (133 loc) · 4.19 KB
/
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
name: Release
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
tag_name:
description: "Enter Tag for the release"
required: true
prerelease:
description: "Is this a pre-release?"
required: true
type: boolean
default: false
# https://typicode.github.io/husky/how-to.html#ci-server-and-docker
env:
HUSKY: 0
jobs:
release_prereq:
name: Build, Test, and Package (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: linux
- os: macos-latest
arch: macos
- os: windows-latest
arch: windows
max-parallel: 3
outputs:
tag_name: ${{ steps.determine_tag.outputs.tag_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Determine the tag
id: determine_tag
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "tag_name=${{ inputs.tag_name }}" >> $GITHUB_OUTPUT
else
echo "tag_name=${{ github.ref }}" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Install dependencies
run: npm ci
# Run tests on different OSes
- name: Run tests (Linux)
if: matrix.arch == 'linux'
run: xvfb-run -a npm run test
- name: Run tests (macOS)
if: matrix.arch == 'macos'
run: npm test
- name: Run tests (Windows)
if: matrix.arch == 'windows'
shell: cmd
run: npm test
# clean
- name: Clean build
run: |
npm run clean
npm run build
# Collect assets
- name: Collect assets
run: npm run collect-assets
# Copy files to dist folder
- name: Copy files to dist folder
run: npm run dist
# Build VSIX package
- name: Build VSIX package
run: npm run package
# Upload VSIX artifact (linux )
- name: Upload VSIX artifact
if: matrix.arch == 'linux'
uses: actions/upload-artifact@v4
with:
name: vscode-extension-${{ matrix.arch }}
path: ./dist/*.vsix
generate_changelog:
name: Generate Changelog
needs: release_prereq
uses: konveyor/release-tools/.github/workflows/generate-changelog.yml@main
with:
version: ${{ needs.release_prereq.outputs.tag_name }}
prev_version: $(gh api repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
repository: ${{ github.repository }}
ref: ${{ github.sha }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
release:
name: Final Release
runs-on: ubuntu-latest
needs: [release_prereq, generate_changelog]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Changelog Artifact
uses: actions/download-artifact@v4
with:
name: changelog-artifact
path: ./artifacts
- name: List available artifacts
run: |
curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts
- name: Download Linux Artifact
uses: actions/download-artifact@v4
with:
name: vscode-extension-linux
path: ./artifacts/vscode-extension-linux
- name: Verify Downloaded Artifacts
run: ls -R ./artifacts
- name: Rename VSIX Packages
run: |
mv ./artifacts/vscode-extension-linux/*.vsix ./artifacts/konveyor-${{ needs.release_prereq.outputs.tag_name }}.vsix
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.release_prereq.outputs.tag_name }}
commit: ${{ github.sha }}
bodyFile: ./artifacts/release.md
artifacts: |
./artifacts/konveyor-*.vsix
prerelease: ${{ github.event.inputs.prerelease }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}