Skip to content

Commit dde1398

Browse files
authored
fix(build.yml): Use tar for unix-like system (#216)
* fix(build.yml): Use tar for unix-like system * Detail build * use fromjson * Try push into same dist * Try upload to release * correct push * correct push * add token * export var * Use tag instead * correct name
1 parent 75441e7 commit dde1398

File tree

2 files changed

+45
-13
lines changed

2 files changed

+45
-13
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,49 @@ jobs:
6060
mv COPYING dist
6161
mv README.md dist
6262
63-
- name: Uploading...
64-
uses: actions/upload-artifact@v3
65-
with:
66-
name: eask_${{ env.VERSION }}_${{ matrix.target }}
67-
path: dist
63+
- name: Setup environment (Unix)
64+
if: contains(fromJSON('["linux-arm64", "linux-x64", "macos-arm64", "macos-x64"]'), matrix.target)
65+
run: |
66+
echo "_EXT=tar.gz" >> $GITHUB_ENV
67+
68+
- name: Setup environment (Windows)
69+
if: contains(fromJSON('["win-arm64", "win-x64"]'), matrix.target)
70+
run: |
71+
echo "_EXT=zip" >> $GITHUB_ENV
72+
73+
- name: Change permissions (Unix)
74+
if: contains(fromJSON('["linux-arm64", "linux-x64", "macos-arm64", "macos-x64"]'), matrix.target)
75+
run: |
76+
chmod -R 777 ./dist
6877
69-
- name: Zipping dist
78+
- name: Tar dist (Unix)
79+
if: contains(fromJSON('["linux-arm64", "linux-x64", "macos-arm64", "macos-x64"]'), matrix.target)
80+
run: |
81+
tar czf ${{ matrix.target }}.${{ env._EXT }} -C ./dist/ .
82+
cp ${{ matrix.target }}.${{ env._EXT }} eask_${{ env.VERSION }}_${{ matrix.target }}.${{ env._EXT }}
83+
84+
- name: Zipping dist (Windows)
85+
if: contains(fromJSON('["win-arm64", "win-x64"]'), matrix.target)
7086
working-directory: dist
7187
run: |
72-
zip -r ${{ matrix.target }}.zip .
73-
mv ${{ matrix.target }}.zip ../
88+
zip -r ${{ matrix.target }}.${{ env._EXT }} .
89+
mv ${{ matrix.target }}.${{ env._EXT }} ../
90+
cd ..
91+
cp ${{ matrix.target }}.${{ env._EXT }} eask_${{ env.VERSION }}_${{ matrix.target }}.${{ env._EXT }}
92+
93+
- name: Uploading...
94+
if: github.ref == 'refs/heads/master'
95+
uses: softprops/[email protected]
96+
with:
97+
repository: ${{ env.REPO_BIN }}
98+
tag_name: ${{ env.VERSION }}
99+
token: ${{ secrets.PAT }}
100+
files: eask_${{ env.VERSION }}_${{ matrix.target }}.${{ env._EXT }}
101+
102+
#### Prepare to push to `binaries` repository!
74103

75-
- name: Move zip to HOME
76-
run: mv ${{ matrix.target }}.zip ~/
104+
- name: Move tar to HOME
105+
run: mv ${{ matrix.target }}.${{ env._EXT }} ~/
77106

78107
- name: Checkout binaries repository
79108
uses: actions/checkout@v4
@@ -84,10 +113,10 @@ jobs:
84113

85114
- name: Clean up previous binaires
86115
continue-on-error: true
87-
run: rm -rf eask/${{ matrix.target }}.zip
116+
run: rm -rf eask/${{ matrix.target }}.${{ env._EXT }}
88117

89118
- name: Move binaires to repository
90-
run: mv ~/${{ matrix.target }}.zip ./
119+
run: mv ~/${{ matrix.target }}.${{ env._EXT }} ./
91120

92121
- name: Set git config
93122
run: |
@@ -99,7 +128,7 @@ jobs:
99128
run: |
100129
git pull
101130
git add .
102-
git commit -m "Update binairs ${{ matrix.target }}.zip"
131+
git commit -m "Update binairs ${{ matrix.target }}.${{ env._EXT }}"
103132
104133
- name: Push
105134
if: github.ref == 'refs/heads/master'

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,6 @@ dist/
156156
# packaging
157157
*-autoloads.el
158158
*-pkg.el
159+
*.zip
160+
*.tar
161+
*.tar.gz

0 commit comments

Comments
 (0)