11name : Release LSP
22
33on :
4- push :
5- tags :
6- - ' *'
4+ workflow_run :
5+ workflows : ["Release"]
6+ types :
7+ - completed
78
89jobs :
10+ get-tag :
11+ name : Get Release Tag
12+ runs-on : ubuntu-latest
13+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
14+ outputs :
15+ tag : ${{ steps.get-tag.outputs.tag }}
16+ steps :
17+ - name : Get tag from latest release
18+ id : get-tag
19+ env :
20+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
21+ run : |
22+ TAG=$(gh api repos/${{ github.repository }}/releases/latest --jq '.tag_name')
23+ echo "tag=$TAG" >> $GITHUB_OUTPUT
24+
925 release :
1026 name : Release LSP - ${{ matrix.os }} (${{ matrix.arch }})
1127 runs-on : ${{ matrix.runner }}
28+ needs : get-tag
1229 strategy :
1330 matrix :
1431 include :
5269 steps :
5370 - name : Checkout Source
5471 uses : actions/checkout@v4
55-
56- - name : Set variables
57- id : vars
58- shell : bash
59- run : |
60- echo "package_name=$(sed -En 's/name[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1)" >> $GITHUB_OUTPUT
61- echo "package_version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
72+ with :
73+ ref : ${{ needs.get-tag.outputs.tag }}
6274
6375 - name : Install Rust toolchain
6476 uses : dtolnay/rust-toolchain@stable
@@ -97,51 +109,30 @@ jobs:
97109 name : ${{ matrix.asset_name }}
98110 path : target/${{ matrix.target }}/release/${{ matrix.binary_name }}
99111
100- create-release :
101- name : Create LSP Release
112+ upload-lsp-binaries :
113+ name : Upload LSP Binaries
102114 runs-on : ubuntu-latest
103- needs : release
115+ needs : [get-tag, release]
104116 steps :
105- - name : Checkout Source
106- uses : actions/checkout@v4
107-
108- - name : Set variables
109- id : vars
117+ - name : Get upload URL
118+ id : get-upload-url
119+ env :
120+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
110121 run : |
111- echo "package_name =$(sed -En 's/name[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1)" >> $GITHUB_OUTPUT
112- echo "package_version=${GITHUB_REF#refs/tags/} " >> $GITHUB_OUTPUT
122+ UPLOAD_URL =$(gh release view ${{ needs.get-tag.outputs.tag }} --json uploadUrl --jq '.uploadUrl')
123+ echo "upload_url=$UPLOAD_URL " >> $GITHUB_OUTPUT
113124
114125 - name : Download all artifacts
115126 uses : actions/download-artifact@v4
116127 with :
117128 path : artifacts
118129
119- - name : Remove Same Release
120- uses : omarabid-forks/action-rollback@stable
121- continue-on-error : true
122- with :
123- tag : ${{ steps.vars.outputs.package_version }}
124- env :
125- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
126-
127- - name : Create Release
128- id : create-release
129- uses : actions/create-release@latest
130- env :
131- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
132- with :
133- tag_name : ${{ steps.vars.outputs.package_version }}
134- release_name : LSP Server ${{ steps.vars.outputs.package_version }}
135- body : ${{ steps.vars.outputs.package_name }} LSP Server - ${{ steps.vars.outputs.package_version }}
136- draft : false
137- prerelease : false
138-
139130 - name : Upload Linux x64 binary
140131 uses : actions/upload-release-asset@v1
141132 env :
142133 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
143134 with :
144- upload_url : ${{ steps.create-release .outputs.upload_url }}
135+ upload_url : ${{ steps.get-upload-url .outputs.upload_url }}
145136 asset_path : artifacts/ci-lsp-linux-x64/ci
146137 asset_name : ci-lsp-linux-x64
147138 asset_content_type : application/octet-stream
@@ -151,7 +142,7 @@ jobs:
151142 env :
152143 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
153144 with :
154- upload_url : ${{ steps.create-release .outputs.upload_url }}
145+ upload_url : ${{ steps.get-upload-url .outputs.upload_url }}
155146 asset_path : artifacts/ci-lsp-linux-arm64/ci
156147 asset_name : ci-lsp-linux-arm64
157148 asset_content_type : application/octet-stream
@@ -161,7 +152,7 @@ jobs:
161152 env :
162153 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
163154 with :
164- upload_url : ${{ steps.create-release .outputs.upload_url }}
155+ upload_url : ${{ steps.get-upload-url .outputs.upload_url }}
165156 asset_path : artifacts/ci-lsp-windows-x64.exe/ci.exe
166157 asset_name : ci-lsp-windows-x64.exe
167158 asset_content_type : application/octet-stream
@@ -171,7 +162,7 @@ jobs:
171162 env :
172163 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
173164 with :
174- upload_url : ${{ steps.create-release .outputs.upload_url }}
165+ upload_url : ${{ steps.get-upload-url .outputs.upload_url }}
175166 asset_path : artifacts/ci-lsp-windows-arm64.exe/ci.exe
176167 asset_name : ci-lsp-windows-arm64.exe
177168 asset_content_type : application/octet-stream
@@ -181,7 +172,7 @@ jobs:
181172 env :
182173 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
183174 with :
184- upload_url : ${{ steps.create-release .outputs.upload_url }}
175+ upload_url : ${{ steps.get-upload-url .outputs.upload_url }}
185176 asset_path : artifacts/ci-lsp-darwin-x64/ci
186177 asset_name : ci-lsp-darwin-x64
187178 asset_content_type : application/octet-stream
@@ -191,7 +182,7 @@ jobs:
191182 env :
192183 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
193184 with :
194- upload_url : ${{ steps.create-release .outputs.upload_url }}
185+ upload_url : ${{ steps.get-upload-url .outputs.upload_url }}
195186 asset_path : artifacts/ci-lsp-darwin-arm64/ci
196187 asset_name : ci-lsp-darwin-arm64
197188 asset_content_type : application/octet-stream
0 commit comments