@@ -18,17 +18,67 @@ permissions:
1818 contents : write
1919
2020jobs :
21- check :
21+
22+ # # Release preparation
23+ # #########################################################################
24+
25+ # From: https://github.com/RobLoach/node-raylib/blob/aca2956e9ed283e5e91b1c8f08fafd943b5d6344/.github/workflows/release.yml
26+ create_release :
27+ runs-on : ubuntu-latest
28+ outputs :
29+ upload_url : ${{ steps.create_release.outputs.upload_url }}
30+ steps :
31+
32+ - uses : actions/checkout@v3
33+ if : startsWith(github.ref, 'refs/tags/v')
34+
35+ - name : Create release
36+ if : startsWith(github.ref, 'refs/tags/v')
37+ id : create_release
38+ uses : actions/create-release@v1
39+ with :
40+ draft : false
41+ prerelease : false
42+ release_name : fix-whitespace ${{ github.ref }}
43+ tag_name : ${{ github.ref }}
44+ # body: fix-whitespace binary release created from ${{ github.ref }}
45+ env :
46+ GITHUB_TOKEN : ${{ github.token }}
47+
48+ - name : Source tarball creation.
49+ # Conditional to ensure this deployment is only run once per action.
50+ if : startsWith(github.ref, 'refs/tags/v')
51+ run : |
52+ cabal sdist
53+ export DIST_TGZ_PATH=$(cabal sdist | tail -1)
54+ export DIST_TGZ_NAME=$(basename "${DIST_TGZ_PATH}")
55+ echo "DIST_TGZ_PATH=${DIST_TGZ_PATH}" >> ${GITHUB_ENV}
56+ echo "DIST_TGZ_NAME=${DIST_TGZ_NAME}" >> ${GITHUB_ENV}
57+
58+ - name : Source tarball release.
59+ if : startsWith(github.ref, 'refs/tags/v')
60+ uses : actions/upload-release-asset@v1
61+ env :
62+ GITHUB_TOKEN : ${{ github.token }}
63+ with :
64+ upload_url : ${{ steps.create_release.outputs.upload_url }}
65+ asset_path : ${{ env.DIST_TGZ_PATH }}
66+ asset_name : ${{ env.DIST_TGZ_NAME }}
67+ asset_content_type : application/octet-stream
68+
69+
70+ build :
2271 runs-on : ${{ matrix.os }}
72+ needs : create_release
2373 strategy :
2474 matrix :
2575 os : [ubuntu-20.04]
26- ghc-ver : [9.2.4 , 9.0.2, 8.10.7, 8.8.4, 8.6.5, 8.4.4, 8.2.2, 8.0.2]
76+ ghc-ver : [9.4.3, 9.2.5 , 9.0.2, 8.10.7, 8.8.4, 8.6.5, 8.4.4, 8.2.2, 8.0.2]
2777 include :
2878 - os : windows-2022
2979 ghc-ver : 9.2.4
3080 - os : macos-11
31- ghc-ver : 9.2.4
81+ ghc-ver : 9.2.5
3282 fail-fast : false
3383
3484 env :
@@ -90,49 +140,65 @@ jobs:
90140 # # Release
91141 # #######################################################################
92142
93- - name : Source tarball creation.
94- # Conditional to ensure this deployment is only run once per action.
95- if : >-
96- startsWith(github.ref, 'refs/tags/v')
97- && matrix.ghc-ver == '9.2.4 '
98- run : |
99- export DIST_TGZ=$(cabal sdist source | tail -1)
100- echo "DIST_TGZ=${DIST_TGZ}" >> ${GITHUB_ENV}
143+ # - name: Source tarball creation.
144+ # # Conditional to ensure this deployment is only run once per action.
145+ # if: >-
146+ # startsWith(github.ref, 'refs/tags/v')
147+ # && matrix.ghc-ver == '9.2.5 '
148+ # run: |
149+ # export DIST_TGZ=$(cabal sdist | tail -1)
150+ # echo "DIST_TGZ=${DIST_TGZ}" >> ${GITHUB_ENV}
101151
102- - name : Source tarball release.
103- if : >-
104- startsWith(github.ref, 'refs/tags/v')
105- && matrix.ghc-ver == '9.2.4'
106- uses : softprops/action-gh-release@v1
107- with :
108- draft : true
109- prerelease : true
110- files : |
111- ${{ env.DIST_TGZ }}
152+ # - name: Source tarball release.
153+ # if: >-
154+ # startsWith(github.ref, 'refs/tags/v')
155+ # && matrix.ghc-ver == '9.2.5'
156+ # # uses: softprops/action-gh-release@v1
157+ # # with:
158+ # # draft: true
159+ # # prerelease: true
160+ # # files: |
161+ # # ${{ env.DIST_TGZ }}
162+ # uses: actions/upload-release-asset@v1
163+ # env:
164+ # GITHUB_TOKEN: ${{ github.token }}
165+ # with:
166+ # upload_url: ${{ needs.create_release.outputs.upload_url }}
167+ # asset_path: ${{ env.DIST_TGZ }}
168+ # asset_name: ${{ env.DIST_TGZ }}
169+ # asset_content_type: application/octet-stream
112170
113171
114172 - name : Linux release preparation.
115173 if : >-
116174 startsWith(github.ref, 'refs/tags/v')
117175 && runner.os == 'Linux'
118- && matrix.ghc-ver == '9.2.4 '
176+ && matrix.ghc-ver == '9.2.5 '
119177 run : |
120178 export FIXW_BIN=fix-whitespace-${FIXW_VERSION}-linux.binary
121179 cp -p ${FIXW_EXE} ${FIXW_BIN}
122180 # Save env variables for the next step
123181 echo "FIXW_BIN=${FIXW_BIN}" >> ${GITHUB_ENV}
124182
125- - name : Linux release.
126- if : >-
127- startsWith(github.ref, 'refs/tags/v')
128- && runner.os == 'Linux'
129- && matrix.ghc-ver == '9.2.4'
130- uses : softprops/action-gh-release@v1
131- with :
132- draft : true
133- prerelease : true
134- files : |
135- ${{ env.FIXW_BIN }}
183+ # - name: Linux release.
184+ # if: >-
185+ # startsWith(github.ref, 'refs/tags/v')
186+ # && runner.os == 'Linux'
187+ # && matrix.ghc-ver == '9.2.5'
188+ # # uses: softprops/action-gh-release@v1
189+ # # with:
190+ # # draft: true
191+ # # prerelease: true
192+ # # files: |
193+ # # ${{ env.FIXW_BIN }}
194+ # uses: actions/upload-release-asset@v1
195+ # env:
196+ # GITHUB_TOKEN: ${{ github.token }}
197+ # with:
198+ # upload_url: ${{ needs.create_release.outputs.upload_url }}
199+ # asset_path: ${{ env.FIXW_BIN }}
200+ # asset_name: ${{ env.FIXW_BIN }}
201+ # asset_content_type: application/octet-stream
136202
137203
138204 - name : Mac release preparation.
@@ -146,16 +212,24 @@ jobs:
146212 # Save env variables for the next step
147213 echo "FIXW_BIN=${FIXW_BIN}" >> ${GITHUB_ENV}
148214
149- - name : Mac release.
150- if : >-
151- startsWith(github.ref, 'refs/tags/v')
152- && runner.os == 'macOS'
153- uses : softprops/action-gh-release@v1
154- with :
155- draft : true
156- prerelease : true
157- files : |
158- ${{ env.FIXW_BIN }}
215+ # - name: Mac release.
216+ # if: >-
217+ # startsWith(github.ref, 'refs/tags/v')
218+ # && runner.os == 'macOS'
219+ # # uses: softprops/action-gh-release@v1
220+ # # with:
221+ # # draft: true
222+ # # prerelease: true
223+ # # files: |
224+ # # ${{ env.FIXW_BIN }}
225+ # uses: actions/upload-release-asset@v1
226+ # env:
227+ # GITHUB_TOKEN: ${{ github.token }}
228+ # with:
229+ # upload_url: ${{ needs.create_release.outputs.upload_url }}
230+ # asset_path: ${{ env.FIXW_BIN }}
231+ # asset_name: ${{ env.FIXW_BIN }}
232+ # asset_content_type: application/octet-stream
159233
160234
161235 - name : Windows release preparation.
@@ -164,18 +238,39 @@ jobs:
164238 && runner.os == 'Windows'
165239 shell : bash
166240 run : |
167- export FIXW_VER_EXE =fix-whitespace-${FIXW_VERSION}.exe
168- cp -p ${FIXW_EXE}.exe ${FIXW_VER_EXE }
241+ export FIXW_BIN =fix-whitespace-${FIXW_VERSION}.exe
242+ cp -p ${FIXW_EXE}.exe ${FIXW_BIN }
169243 # Save env variables for the next step
170- echo "FIXW_VER_EXE =${FIXW_VER_EXE }" >> ${GITHUB_ENV}
244+ echo "FIXW_BIN =${FIXW_BIN }" >> ${GITHUB_ENV}
171245
172- - name : Windows release.
246+ # - name: Windows release.
247+ # if: >-
248+ # startsWith(github.ref, 'refs/tags/v')
249+ # && runner.os == 'Windows'
250+ # uses: actions/upload-release-asset@v1
251+ # env:
252+ # GITHUB_TOKEN: ${{ github.token }}
253+ # with:
254+ # upload_url: ${{ needs.create_release.outputs.upload_url }}
255+ # asset_path: ${{ env.FIXW_BIN }}
256+ # asset_name: ${{ env.FIXW_BIN }}
257+ # asset_content_type: application/octet-stream
258+ # # uses: softprops/action-gh-release@v1
259+ # # with:
260+ # # draft: true
261+ # # prerelease: true
262+ # # files: |
263+ # # ${{ env.FIXW_VER_EXE }}
264+
265+ - name : Upload binary.
173266 if : >-
174267 startsWith(github.ref, 'refs/tags/v')
175- && runner.os == 'Windows'
176- uses : softprops/action-gh-release@v1
268+ && (matrix.ghc-ver == '9.2.5' || !(runner.os == 'Linux'))
269+ uses : actions/upload-release-asset@v1
270+ env :
271+ GITHUB_TOKEN : ${{ github.token }}
177272 with :
178- draft : true
179- prerelease : true
180- files : |
181- ${{ env.FIXW_VER_EXE }}
273+ upload_url : ${{ needs.create_release.outputs.upload_url }}
274+ asset_path : ${{ env.FIXW_BIN }}
275+ asset_name : ${{ env.FIXW_BIN }}
276+ asset_content_type : application/octet-stream
0 commit comments