From 4e4400f02a652004e13674352b0a9b83260d8bab Mon Sep 17 00:00:00 2001 From: 0xNOY Date: Sat, 29 Apr 2023 23:49:15 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=E3=83=AA=E3=83=AA=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E3=81=A8=E3=83=93=E3=83=AB=E3=83=89=E3=81=AE=E8=87=AA=E5=8B=95?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 32d6281..505ba1c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: - "v[0-9]+.[0-9]+.[0-9]+" env: - APP_NAME: "tmgw_wifi_authorizer" + APP_NAME: "tmgw-wifi-authorizer" jobs: create-release: @@ -24,7 +24,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} + release_name: ${{ github.ref_name }} draft: false prerelease: false @@ -45,18 +45,30 @@ jobs: runs-on: ${{ matrix.os }} + env: + APP_EXTENSION: ${{ contains(matrix.os, 'windows') && '.exe' || '' }} + CARGO_DST: '' + ZIP_DST: '' + steps: - name: Checkout uses: actions/checkout@v3 + - name: Set ENV + run: | + echo "CARGO_DST=target/${{ matrix.target }}/release/${{ env.APP_NAME }}${{ env.APP_EXTENSION }}" >> ${{ contains(matrix.os, 'windows') && '$env:GITHUB_ENV' || '$GITHUB_ENV' }} + echo "ZIP_DST=${{ env.APP_NAME }}-${{ matrix.target }}.zip" >> ${{ contains(matrix.os, 'windows') && '$env:GITHUB_ENV' || '$GITHUB_ENV' }} + - name: Build run: cargo build --release --target ${{ matrix.target }} - - name: Archive - uses: actions/upload-artifact@v3 - with: - name: ${{ env.APP_NAME }}_${{ matrix.target }} - path: target/${{ matrix.target }}/release/${{ env.APP_NAME }} + - name: Zip binary for Linux and MacOS + if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') + run: zip -j ${{ env.ZIP_DST }} ${{ env.CARGO_DST }} + + - name: Zip binary for Windows + if: contains(matrix.os, 'windows') + run: powershell Compress-Archive -Path ${{ env.CARGO_DST }} -DestinationPath ${{ env.ZIP_DST }} - name: Upload to release uses: actions/upload-release-asset@v1 @@ -64,6 +76,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: target/${{ matrix.target }}/release/${{ env.APP_NAME }} - asset_name: ${{ env.APP_NAME }}_${{ matrix.target }} - asset_content_type: application/octet-stream \ No newline at end of file + asset_path: ${{ env.ZIP_DST }} + asset_name: ${{ env.ZIP_DST }} + asset_content_type: application/zip \ No newline at end of file