forked from dtschan/vim-static
-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (149 loc) · 6.52 KB
/
cron.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Build Auto
on:
schedule:
- cron: '0 0 1 * *'
jobs:
version-detect:
runs-on: ubuntu-latest
steps:
- name: Detect latest stable version
run: printf '%s\n' "$(curl -Ls https://api.github.com/repos/vim/vim/tags | jq '.[0].name' -r)" > latest.txt
- name: Gather all tagged version
run: curl -Ls https://api.github.com/repos/lxhillwind/vim-bin/releases | jq -r '.[].tag_name' | sort > tagged.txt
- name: Detect if tagged
# fail if already exists.
run: test -z "$(comm -12 latest.txt tagged.txt)"
- name: Share version
uses: actions/upload-artifact@v2
with:
name: ver
path: latest.txt
build-linux:
runs-on: ubuntu-latest
needs: version-detect
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Download version
uses: actions/download-artifact@v2
with:
name: ver
- name: Build the Docker image
run: docker build . --file Dockerfile --build-arg VIM_VERSION=$(cat latest.txt) --tag vim-build:$(cat latest.txt)
- name: Generate artifacts
run: docker run --rm -i vim-build:$(cat latest.txt) cat /out/vim-$(cat latest.txt).tar.xz > vim-linux-x64.tar.xz
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: vim-linux
path: vim-linux-x64.tar.xz
build-win32-x86:
runs-on: ubuntu-latest
needs: version-detect
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Download version
uses: actions/download-artifact@v2
with:
name: ver
- name: Build the Docker image
run: docker build . --file Dockerfile.mingw-x86 --build-arg VIM_VERSION=$(cat latest.txt) --tag vim-build-win32-x86:$(cat latest.txt)
- name: Generate artifacts
run: docker run --rm -i vim-build-win32-x86:$(cat latest.txt) cat /out/vim-$(cat latest.txt).7z > vim-win32-x86.7z
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: vim-win32-x86
path: vim-win32-x86.7z
build-win32-x64:
runs-on: ubuntu-latest
needs: version-detect
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Download version
uses: actions/download-artifact@v2
with:
name: ver
- name: Build the Docker image
run: docker build . --file Dockerfile.mingw-x64 --build-arg VIM_VERSION=$(cat latest.txt) --tag vim-build-win32-x64:$(cat latest.txt)
- name: Generate artifacts
run: docker run --rm -i vim-build-win32-x64:$(cat latest.txt) cat /out/vim-$(cat latest.txt).7z > vim-win32-x64.7z
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: vim-win32-x64
path: vim-win32-x64.7z
release:
runs-on: ubuntu-latest
needs: [build-linux, build-win32-x86, build-win32-x64]
steps:
- name: Download version
uses: actions/download-artifact@v2
with:
name: ver
- name: Download linux
uses: actions/download-artifact@v2
with:
name: vim-linux
- name: Download win32 (x86)
uses: actions/download-artifact@v2
with:
name: vim-win32-x86
- name: Download win32 (x64)
uses: actions/download-artifact@v2
with:
name: vim-win32-x64
- name: Set version
id: latest-ver-get
run: printf '::set-output name=latest::%s\n' $(cat latest.txt)
- name: Checksum
id: checksum
run: |
printf '::set-output name=linux-x64::%s\n' $(sha1sum vim-linux-x64.tar.xz | cut -d' ' -f1);
printf '::set-output name=win32-x86::%s\n' $([ -f vim-win32-x86.7z ] && { sha1sum vim-win32-x86.7z | cut -d' ' -f1; } || echo 'empty');
printf '::set-output name=win32-x64::%s\n' $([ -f vim-win32-x64.7z ] && { sha1sum vim-win32-x64.7z | cut -d' ' -f1; } || echo 'empty');
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.latest-ver-get.outputs.latest }}
release_name: Package ${{ steps.latest-ver-get.outputs.latest }}
draft: false
prerelease: false
body: |
Package ${{ steps.latest-ver-get.outputs.latest }}
sha1sum:
- `${{ steps.checksum.outputs.linux-x64 }} vim-${{ steps.latest-ver-get.outputs.latest }}-linux-x64.tar.xz`
- `${{ steps.checksum.outputs.win32-x86 }} vim-${{ steps.latest-ver-get.outputs.latest }}-win32-x86.7z` (compiled for Windows XP; **USE AT YOUR OWN RISK!**)
- `${{ steps.checksum.outputs.win32-x64 }} vim-${{ steps.latest-ver-get.outputs.latest }}-win32-x64.7z`
- name: Upload Release Asset linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./vim-linux-x64.tar.xz
asset_name: vim-${{ steps.latest-ver-get.outputs.latest }}-linux-x64.tar.xz
asset_content_type: application/x-tar
- name: Upload Release Asset win32 (x86)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./vim-win32-x86.7z
asset_name: vim-${{ steps.latest-ver-get.outputs.latest }}-win32-x86.7z
asset_content_type: application/x-7z-compressed
- name: Upload Release Asset win32 (x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./vim-win32-x64.7z
asset_name: vim-${{ steps.latest-ver-get.outputs.latest }}-win32-x64.7z
asset_content_type: application/x-7z-compressed