-
Notifications
You must be signed in to change notification settings - Fork 14
142 lines (117 loc) · 4.03 KB
/
publish.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
name: Publish VSIX
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
permissions:
contents: read
actions: read
jobs:
package-vsix:
strategy:
matrix:
include:
- os: windows-latest
platform: win
arch: x64
target: win32-x64
- os: ubuntu-latest
platform: linux
arch: x64
target: linux-x64
- os: macos-latest
platform: mac
arch: x64
target: darwin-x64
- os: macos-latest
platform: mac
arch: arm64
target: darwin-arm64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.SOURCERY_RELEASE_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: latest
- run: yarn install --frozen-lockfile
- name: Update binaries
run: |
./download-binaries.sh ${{ github.event.inputs.version }}
mkdir -p sourcery_binaries/install
rm -rf sourcery_binaries/install/*
mv downloaded_binaries/${{matrix.platform}}-${{matrix.arch}} sourcery_binaries/install/${{matrix.platform}}
- name: Update version number
run: yarn run bump ${{ github.event.inputs.version }}
# TODO: Make this release not pre-release once tested.
- name: Package VSCode extension
run: yarn run vsce package --target ${{matrix.target}} --pre-release
- name: Rename packaged VSIX file
run: mv sourcery-*.vsix sourcery-${{ github.event.inputs.version }}-${{ matrix.target }}.vsix
- name: Upload archive
uses: actions/upload-artifact@v4
with:
path: '*.vsix'
name: sourcery-${{ github.event.inputs.version }}-${{ matrix.target }}
publish-vsix:
runs-on: ubuntu-latest
needs: package-vsix
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.SOURCERY_RELEASE_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: latest
- run: yarn install --frozen-lockfile
- name: Update version number
run: yarn run bump ${{ github.event.inputs.version }}
- name: Commit to main, create tag, and push
run: |
git add .
git config --global user.name ${{ github.actor }}
git config --global user.email ${{ github.actor }}@users.noreply.github.com
git commit -m 'Update version number to v${{ github.event.inputs.version }}'
git tag v${{ github.event.inputs.version }}
git push origin main v${{ github.event.inputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.SOURCERY_RELEASE_TOKEN }}
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts
# TODO: Make this release not pre-release once tested.
- name: Package and publish VSCode extension
run: |
yarn run vsce publish --packagePath $(find . -iname *.vsix) -p ${{ secrets.VSCE_TOKEN }} --pre-release
# TODO: Make this release not pre-release once tested.
- name: Create release
uses: ncipollo/release-action@v1
with:
tag: v${{ github.event.inputs.version }}
name: Sourcery ${{ github.event.inputs.version }}
body: v${{ github.event.inputs.version }}
prerelease: true
artifacts: 'artifacts/*.vsix'
artifactContentType: raw
artifactErrorsFailBuild: true
token: ${{ secrets.SOURCERY_RELEASE_TOKEN }}
- name: Update version number to dev
run: |
yarn run bump prepatch --preid dev
git commit -am 'Bump version to dev'
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.SOURCERY_RELEASE_TOKEN }}
- name: Notify Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: Publish VS Code extension v${{ github.event.inputs.version }} - ${{ job.status }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_RELEASES_WEBHOOK_URL }}
if: always()