Skip to content

Commit 4c3f506

Browse files
authored
ci: Use include instead of _EXT (#395)
* ci: Use include instead of _EXT * ci: simplify
1 parent 6584417 commit 4c3f506

1 file changed

Lines changed: 26 additions & 30 deletions

File tree

.github/workflows/build.yml

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,19 @@ jobs:
5050
strategy:
5151
fail-fast: false
5252
matrix:
53-
target:
54-
- linux-arm64
55-
- linux-x64
56-
- macos-arm64
57-
- macos-x64
58-
- win-arm64
59-
- win-x64
53+
include:
54+
- target: linux-arm64
55+
ext: tar.gz
56+
- target: linux-x64
57+
ext: tar.gz
58+
- target: macos-arm64
59+
ext: tar.gz
60+
- target: macos-x64
61+
ext: tar.gz
62+
- target: win-arm64
63+
ext: zip
64+
- target: win-x64
65+
ext: zip
6066

6167
steps:
6268
- uses: actions/checkout@v6
@@ -82,35 +88,25 @@ jobs:
8288
mv COPYING dist
8389
mv README.md dist
8490
85-
- name: Setup environment (Unix)
86-
if: contains(fromJSON('["linux-arm64", "linux-x64", "macos-arm64", "macos-x64"]'), matrix.target)
87-
run: |
88-
echo "_EXT=tar.gz" >> $GITHUB_ENV
89-
90-
- name: Setup environment (Windows)
91-
if: contains(fromJSON('["win-arm64", "win-x64"]'), matrix.target)
92-
run: |
93-
echo "_EXT=zip" >> $GITHUB_ENV
94-
9591
- name: Change permissions (Unix)
96-
if: contains(fromJSON('["linux-arm64", "linux-x64", "macos-arm64", "macos-x64"]'), matrix.target)
92+
if: contains(fromJSON('["tar.gz"]'), matrix.ext)
9793
run: |
9894
chmod -R 777 ./dist
9995
10096
- name: Tar dist (Unix)
101-
if: contains(fromJSON('["linux-arm64", "linux-x64", "macos-arm64", "macos-x64"]'), matrix.target)
97+
if: contains(fromJSON('["tar.gz"]'), matrix.ext)
10298
run: |
103-
tar -czf ${{ matrix.target }}.${{ env._EXT }} -C ./dist/ .
104-
cp ${{ matrix.target }}.${{ env._EXT }} eask_${{ env.VERSION }}_${{ matrix.target }}.${{ env._EXT }}
99+
tar -czf ${{ matrix.target }}.${{ matrix.ext }} -C ./dist/ .
100+
cp ${{ matrix.target }}.${{ matrix.ext }} eask_${{ env.VERSION }}_${{ matrix.target }}.${{ matrix.ext }}
105101
106102
- name: Zipping dist (Windows)
107-
if: contains(fromJSON('["win-arm64", "win-x64"]'), matrix.target)
103+
if: contains(fromJSON('["zip"]'), matrix.ext)
108104
working-directory: dist
109105
run: |
110-
zip -r ${{ matrix.target }}.${{ env._EXT }} .
111-
mv ${{ matrix.target }}.${{ env._EXT }} ../
106+
zip -r ${{ matrix.target }}.${{ matrix.ext }} .
107+
mv ${{ matrix.target }}.${{ matrix.ext }} ../
112108
cd ..
113-
cp ${{ matrix.target }}.${{ env._EXT }} eask_${{ env.VERSION }}_${{ matrix.target }}.${{ env._EXT }}
109+
cp ${{ matrix.target }}.${{ matrix.ext }} eask_${{ env.VERSION }}_${{ matrix.target }}.${{ matrix.ext }}
114110
115111
- name: Upload for prerelease
116112
if: github.ref == 'refs/heads/master'
@@ -121,7 +117,7 @@ jobs:
121117
allowUpdates: true
122118
prerelease: true
123119
draft: false
124-
artifacts: eask_${{ env.VERSION }}_${{ matrix.target }}.${{ env._EXT }}
120+
artifacts: eask_${{ env.VERSION }}_${{ matrix.target }}.${{ matrix.ext }}
125121

126122
#### Upload an artifact for testing purposes
127123

@@ -134,7 +130,7 @@ jobs:
134130
#### Prepare to push to `binaries` repository!
135131

136132
- name: Move tar to HOME
137-
run: mv ${{ matrix.target }}.${{ env._EXT }} ~/
133+
run: mv ${{ matrix.target }}.${{ matrix.ext }} ~/
138134

139135
- name: Checkout binaries repository
140136
uses: actions/checkout@v6
@@ -145,10 +141,10 @@ jobs:
145141

146142
- name: Clean up previous binaries
147143
continue-on-error: true
148-
run: rm -rf eask/${{ matrix.target }}.${{ env._EXT }}
144+
run: rm -rf eask/${{ matrix.target }}.${{ matrix.ext }}
149145

150146
- name: Move binaries to repository
151-
run: mv ~/${{ matrix.target }}.${{ env._EXT }} ./
147+
run: mv ~/${{ matrix.target }}.${{ matrix.ext }} ./
152148

153149
- name: Set git config
154150
run: |
@@ -160,7 +156,7 @@ jobs:
160156
run: |
161157
git pull
162158
git add .
163-
git commit -m "Update binaries ${{ matrix.target }}.${{ env._EXT }}"
159+
git commit -m "Update binaries ${{ matrix.target }}.${{ matrix.ext }}"
164160
165161
- name: Push
166162
if: github.ref == 'refs/heads/master'

0 commit comments

Comments
 (0)