1+ on :
2+ push :
3+ tags :
4+ - ' [0-9]+.[0-9]+.[0-9]+'
5+
6+ jobs :
7+ build :
8+ runs-on : ubuntu-latest
9+ strategy :
10+ matrix :
11+ include :
12+ - target : alpine-x86_64
13+ vsix : alpine-x64
14+ - target : alpine-aarch64
15+ vsix : alpine-arm64
16+ - target : linux-x86_64
17+ vsix : linux-x64
18+ - target : linux-aarch64
19+ vsix : linux-arm64
20+ - target : darwin-x86_64
21+ vsix : darwin-x64
22+ - target : darwin-aarch64
23+ vsix : darwin-arm64
24+ - target : win32-x86_64
25+ vsix : win32-x64
26+ - target : win32-aarch64
27+ vsix : win32-arm64
28+ steps :
29+ - name : Checkout
30+ uses : actions/checkout@v4
31+
32+ - name : Extract version info
33+ id : version
34+ run : |
35+ TAG="${GITHUB_REF_NAME}"
36+ MINOR=$(echo "$TAG" | cut -d. -f2)
37+ echo "version=$TAG" >> $GITHUB_OUTPUT
38+ echo "changelog_url=https://raw.githubusercontent.com/odoo/odoo-ls/$TAG/changelog.md" >> $GITHUB_OUTPUT
39+ if [ $((MINOR % 2)) -eq 1 ]; then
40+ echo "command=package --prerelease" >> $GITHUB_OUTPUT
41+ else
42+ echo "command=package" >> $GITHUB_OUTPUT
43+ fi
44+
45+ - name : Clone typeshed
46+ run : |
47+ git clone https://github.com/python/typeshed typeshed
48+
49+ - name : Checkout additional stubs from OdooLS
50+ uses : actions/checkout@v4
51+ with :
52+ repository : odoo/odoo-ls
53+ ref : ${{ steps.version.outputs.version }}
54+ path : additional_stubs
55+ sparse-checkout : server/additional_stubs
56+ sparse-checkout-cone-mode : false
57+
58+ - name : Flatten additional_stubs and clean
59+ run : |
60+ # Move the stubs to the root of additional_stubs
61+ mv additional_stubs/server/additional_stubs/* additional_stubs/
62+ rm -rf additional_stubs/server
63+
64+ - name : Replace SCHEMA_VERSION in package.json
65+ run : |
66+ VERSION=${{ steps.version.outputs.version }}
67+ sed -i 's/__SCHEMA_VERSION__/'"$VERSION"'/g' package.json
68+
69+ - name : Download changelog
70+ run : |
71+ wget ${{ steps.version.outputs.changelog_url }}
72+
73+ - name : Install Node.js
74+ uses : actions/setup-node@v4
75+ - run : npm install
76+
77+ - name : Install vsce
78+ uses : actions/setup-node@v4
79+ - run : npm install @vscode/vsce
80+
81+ - name : Download language server ${{ matrix.target }}
82+ run : |
83+ VERSION=${{ steps.version.outputs.version }}
84+ if [[ "${{ matrix.target }}" == win32* ]]; then
85+ wget https://github.com/odoo/odoo-ls/releases/download/$VERSION/odoo-${{ matrix.target }}-$VERSION.zip -O odoo-ls.zip
86+ unzip odoo-ls.zip -d .
87+ rm odoo-ls.zip
88+ else
89+ wget https://github.com/odoo/odoo-ls/releases/download/$VERSION/odoo-${{ matrix.target }}-$VERSION.tar.gz -O odoo-ls.tar.gz
90+ tar -xvzf odoo-ls.tar.gz
91+ rm odoo-ls.tar.gz
92+ fi
93+
94+ - name : Build VSIX for ${{ matrix.target }}
95+ run : npx vsce ${{ steps.version.outputs.command }} --target ${{ matrix.vsix }}
96+ env :
97+ NODE_ENV : production
98+
99+ - name : Upload artifact
100+ uses : actions/upload-artifact@v4
101+ with :
102+ name : vsix-${{ matrix.target }}
103+ path : " *.vsix"
104+
105+ release :
106+ runs-on : ubuntu-latest
107+ needs : build
108+ steps :
109+ - name : Download all artifacts
110+ uses : actions/download-artifact@v4
111+ with :
112+ path : ./dist
113+
114+ - name : Extract version info
115+ id : version
116+ run : |
117+ TAG="${GITHUB_REF_NAME}"
118+ MINOR=$(echo "$TAG" | cut -d. -f2)
119+ echo "changelog_url=https://raw.githubusercontent.com/odoo/odoo-ls/$TAG/changelog.md" >> $GITHUB_OUTPUT
120+ if [ $((MINOR % 2)) -eq 1 ]; then
121+ echo "prerelease=true" >> $GITHUB_OUTPUT
122+ echo "title=$TAG - Beta" >> $GITHUB_OUTPUT
123+ else
124+ echo "prerelease=false" >> $GITHUB_OUTPUT
125+ echo "title=$TAG" >> $GITHUB_OUTPUT
126+ fi
127+
128+ - name : Download changelog
129+ run : |
130+ wget ${{ steps.version.outputs.changelog_url }}
131+
132+ - name : Extract changelog entry
133+ id : changelog
134+ run : |
135+ TAG="${GITHUB_REF_NAME}"
136+ awk "/^## \\[$TAG\\]/ {flag=1; next} /^## \\[/ {flag=0} flag {print}" changelog.md > RELEASE_NOTES.md
137+
138+ - name : Display files
139+ run : ls -R ./dist
140+
141+ - name : Create GitHub Release
142+ uses : softprops/action-gh-release@v2
143+ with :
144+ name : ${{ steps.version.outputs.title }}
145+ tag_name : ${{ github.ref_name }}
146+ prerelease : ${{ steps.version.outputs.prerelease }}
147+ body_path : RELEASE_NOTES.md
148+ files : ./dist/**/*.vsix
149+ env :
150+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments