-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (77 loc) · 3.13 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
name: Release
on:
release:
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:
description: "Tag name"
required: true
env:
VERSION_TAG: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
jobs:
release:
runs-on: ubuntu-latest
name: Publish vsix
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0"
- name: Set environment variables
run: |
VERSION_TMP=${VERSION_TAG#v} # Remove the 'v' prefix
VERSION=${VERSION_TMP%-*} # Remove the '-' build number suffix
echo VERSION=$VERSION >> $GITHUB_ENV
echo GIT_BRANCH_NAME=mark-version-$VERSION-as-released >> $GITHUB_ENV
echo GIT_COMMIT_MESSAGE=Mark version $VERSION as released >> $GITHUB_ENV
- name: Add GitHub NuGet Registry
run: dotnet nuget add source --username "${{ github.actor }}" --password "%GITHUB_TOKEN%" --store-password-in-clear-text --name github "https://nuget.pkg.github.com/GeoWerkstatt/index.json"
- name: Restore packages
run: dotnet restore ./language-server/src
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build language-server
run: dotnet build --no-restore "-p:VersionPrefix=${{ env.VERSION }}" ./language-server/src
- name: Run language-server tests
run: dotnet test --no-build ./language-server/src
- name: Publish language-server
run: |
for rid in win-x64 linux-x64 osx-x64
do
dotnet publish ./language-server/src/Geowerkstatt.Interlis.LanguageServer --self-contained -c Release -r $rid "-p:VersionPrefix=${{ env.VERSION }}" -o ./language-server/bin/$rid
done
- name: Install packages
run: npm ci
- name: Patch changelog
run: sed -i "s/vNext/$VERSION - $(date '+%Y-%m-%d')/" CHANGELOG.md
- name: Pack extension
run: npx vsce pack --no-git-tag-version ${{ env.VERSION }}
- name: Publish extension to marketplace
run: npx vsce publish
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Update GitHub release assets
run: gh release upload ${{ env.VERSION_TAG }} *.vsix --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add vNext to changelog
run: sed -i "/^\#\#\# $VERSION/i \#\#\# vNext\n\n" CHANGELOG.md
- name: Patch package.json version
run: npm version patch --git-tag-version false
- name: Commit, push and create pull request
run: |
git config --local user.email "[email protected]"
git config --local user.name "GeoWerkstatt-Build"
git checkout -b $GIT_BRANCH_NAME
git commit -am "$GIT_COMMIT_MESSAGE"
git push --set-upstream origin $GIT_BRANCH_NAME
gh pr create --title "$GIT_COMMIT_MESSAGE" --body ""
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}