1
+ name : build-macos
2
+
3
+ on :
4
+ push :
5
+ branches : [ "master" ]
6
+ tags : [ 'v*' ]
7
+ pull_request :
8
+ branches : [ "master" ]
9
+
10
+ jobs :
11
+
12
+ build :
13
+ if : startsWith(github.ref, 'refs/tags/')
14
+ runs-on : macos-latest
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+ with :
18
+ submodules : true # This tells checkout action to clone submodules
19
+ token : ${{ secrets.GH_PAT }} # Personal Access Token with repo scope
20
+
21
+ - name : Set up Go
22
+ uses : actions/setup-go@v4
23
+ with :
24
+ go-version : ' 1.21.3'
25
+
26
+ - name : pull
27
+ run : git submodule update --init --recursive
28
+
29
+ - name : Build
30
+ run : go build -o lspvi-macos-amd64-linux
31
+
32
+
33
+
34
+ - name : Check if release exists
35
+ id : check_release
36
+ shell : bash
37
+ run : |
38
+ if gh release view ${{ github.ref_name }} &> /dev/null; then
39
+ echo "release_exists=true" >> $GITHUB_OUTPUT
40
+ else
41
+ echo "release_exists=false" >> $GITHUB_OUTPUT
42
+ fi
43
+ env :
44
+ GITHUB_TOKEN : ${{ secrets.RTOKEN}}
45
+
46
+
47
+ - name : Create Release
48
+ id : create_release
49
+ if : steps.check_release.outputs.release_exists == 'false' && startsWith(github.ref, 'refs/tags/')
50
+ uses : actions/create-release@v1
51
+ env :
52
+ GITHUB_TOKEN : ${{ secrets.RTOKEN }}
53
+ with :
54
+ tag_name : ${{ github.ref_name }}
55
+ release_name : Release ${{ github.ref_name }}
56
+ draft : false
57
+ prerelease : false
58
+
59
+ - name : Get Release Upload URL
60
+ id : get_upload_url
61
+ shell : bash
62
+ run : |
63
+ upload_url=$(gh api repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} | jq -r .upload_url)
64
+ echo $upload_url
65
+ if [[ $upload_url == "" ]]; then
66
+ echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT
67
+ else
68
+ echo "upload_url=$upload_url" >> $GITHUB_OUTPUT
69
+ fi
70
+ # echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT
71
+ # echo "upload_url=$(gh api repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} | jq -r .upload_url)" >> $GITHUB_OUTPUT
72
+ # if [ "${{ steps.check_release.outputs.release_exists }}" == "true" ]; then
73
+ # echo "upload_url=$(gh api repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} | jq -r .upload_url)" >> $GITHUB_OUTPUT
74
+ # else
75
+ # echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT
76
+ # fi
77
+ env :
78
+ GITHUB_TOKEN : ${{ secrets.RTOKEN }}
79
+
80
+
81
+
82
+
83
+
84
+
85
+ - name : Upload Linux Artifact
86
+ uses : actions/upload-release-asset@v1
87
+ env :
88
+ GITHUB_TOKEN : ${{ secrets.RTOKEN }}
89
+ with :
90
+ upload_url : ${{ steps.get_upload_url.outputs.upload_url }}
91
+ asset_path : ./lspvi-amd64-linux
92
+ asset_name : lspvi-amd64-linux
93
+ asset_content_type : application/octet-stream
94
+
95
+
96
+ - name : Upload win64 Artifact
97
+ uses : actions/upload-release-asset@v1
98
+ env :
99
+ GITHUB_TOKEN : ${{ secrets.RTOKEN }}
100
+ with :
101
+ upload_url : ${{ steps.get_upload_url.outputs.upload_url }}
102
+ asset_path : ./lspvi-window-x64
103
+ asset_name : lspvi-window-x64
104
+ asset_content_type : application/octet-stream
0 commit comments