From dde13987ab38b7998d5607a1999b5e4bc855c440 Mon Sep 17 00:00:00 2001 From: Jen-Chieh Shen Date: Fri, 9 Feb 2024 03:29:27 -0800 Subject: [PATCH] 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 --- .github/workflows/build.yml | 55 ++++++++++++++++++++++++++++--------- .gitignore | 3 ++ 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7bf8d5b6..718f182c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,20 +60,49 @@ jobs: mv COPYING dist mv README.md dist - - name: Uploading... - uses: actions/upload-artifact@v3 - with: - name: eask_${{ env.VERSION }}_${{ matrix.target }} - path: dist + - name: Setup environment (Unix) + if: contains(fromJSON('["linux-arm64", "linux-x64", "macos-arm64", "macos-x64"]'), matrix.target) + run: | + echo "_EXT=tar.gz" >> $GITHUB_ENV + + - name: Setup environment (Windows) + if: contains(fromJSON('["win-arm64", "win-x64"]'), matrix.target) + run: | + echo "_EXT=zip" >> $GITHUB_ENV + + - name: Change permissions (Unix) + if: contains(fromJSON('["linux-arm64", "linux-x64", "macos-arm64", "macos-x64"]'), matrix.target) + run: | + chmod -R 777 ./dist - - name: Zipping dist + - name: Tar dist (Unix) + if: contains(fromJSON('["linux-arm64", "linux-x64", "macos-arm64", "macos-x64"]'), matrix.target) + run: | + tar czf ${{ matrix.target }}.${{ env._EXT }} -C ./dist/ . + cp ${{ matrix.target }}.${{ env._EXT }} eask_${{ env.VERSION }}_${{ matrix.target }}.${{ env._EXT }} + + - name: Zipping dist (Windows) + if: contains(fromJSON('["win-arm64", "win-x64"]'), matrix.target) working-directory: dist run: | - zip -r ${{ matrix.target }}.zip . - mv ${{ matrix.target }}.zip ../ + zip -r ${{ matrix.target }}.${{ env._EXT }} . + mv ${{ matrix.target }}.${{ env._EXT }} ../ + cd .. + cp ${{ matrix.target }}.${{ env._EXT }} eask_${{ env.VERSION }}_${{ matrix.target }}.${{ env._EXT }} + + - name: Uploading... + if: github.ref == 'refs/heads/master' + uses: softprops/action-gh-release@v0.1.15 + with: + repository: ${{ env.REPO_BIN }} + tag_name: ${{ env.VERSION }} + token: ${{ secrets.PAT }} + files: eask_${{ env.VERSION }}_${{ matrix.target }}.${{ env._EXT }} + + #### Prepare to push to `binaries` repository! - - name: Move zip to HOME - run: mv ${{ matrix.target }}.zip ~/ + - name: Move tar to HOME + run: mv ${{ matrix.target }}.${{ env._EXT }} ~/ - name: Checkout binaries repository uses: actions/checkout@v4 @@ -84,10 +113,10 @@ jobs: - name: Clean up previous binaires continue-on-error: true - run: rm -rf eask/${{ matrix.target }}.zip + run: rm -rf eask/${{ matrix.target }}.${{ env._EXT }} - name: Move binaires to repository - run: mv ~/${{ matrix.target }}.zip ./ + run: mv ~/${{ matrix.target }}.${{ env._EXT }} ./ - name: Set git config run: | @@ -99,7 +128,7 @@ jobs: run: | git pull git add . - git commit -m "Update binairs ${{ matrix.target }}.zip" + git commit -m "Update binairs ${{ matrix.target }}.${{ env._EXT }}" - name: Push if: github.ref == 'refs/heads/master' diff --git a/.gitignore b/.gitignore index 1275f459..f176bc48 100644 --- a/.gitignore +++ b/.gitignore @@ -156,3 +156,6 @@ dist/ # packaging *-autoloads.el *-pkg.el +*.zip +*.tar +*.tar.gz