From 8131ea3f55c92f3fbf511d052fb782689f13f9fc Mon Sep 17 00:00:00 2001 From: Thaumy Date: Tue, 12 Sep 2023 11:42:31 +0800 Subject: [PATCH] ci: fix create gh release --- .github/actions/make-archive/action.yml | 23 +++++++++++++++++++++++ .github/workflows/build-dev.yml | 2 +- .github/workflows/build-release.yml | 12 +++++++++--- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 .github/actions/make-archive/action.yml diff --git a/.github/actions/make-archive/action.yml b/.github/actions/make-archive/action.yml new file mode 100644 index 0000000..299d3ea --- /dev/null +++ b/.github/actions/make-archive/action.yml @@ -0,0 +1,23 @@ +name: Make Archive +description: Archive files to zip +inputs: + files: + description: files to archive + required: true + out: + description: Output path + required: true +runs: + using: composite + steps: + - name: Archive (UNIX) + if: runner.os != 'Windows' + shell: bash + run: | + zip ${{ inputs.out }} ${{ inputs.files }} -j + + - name: Archive (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + Compress-Archive ${{ inputs.files }} ${{ inputs.out }} diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index d6242ed..c6de4cb 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -84,7 +84,7 @@ jobs: - name: Generate artifacts name id: gen-name shell: bash - run: echo 'NAME=dev-${{ matrix.targets.alias }}' >> $GITHUB_OUTPUT + run: echo 'NAME=cnb-dev-${{ matrix.targets.alias }}' >> $GITHUB_OUTPUT - name: Generate binary extension id: gen-ext diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 280749b..bf8634c 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -64,7 +64,7 @@ jobs: - name: Generate artifacts name id: gen-name shell: bash - run: echo 'NAME=release-${{ matrix.targets.alias }}' >> $GITHUB_OUTPUT + run: echo 'NAME=cnb-${{ steps.gen-version.outputs.VERSION }}-${{ matrix.targets.alias }}' >> $GITHUB_OUTPUT - name: Generate binary extension id: gen-ext @@ -79,8 +79,14 @@ jobs: path: ./target/${{ matrix.targets.target }}/release/cnb${{ steps.gen-ext.outputs.EXT }} if-no-files-found: error - - name: Create github release - uses: softprops/action-gh-release@v1 + - name: Archive binary + uses: ./.github/actions/make-archive with: files: ./target/${{ matrix.targets.target }}/release/cnb${{ steps.gen-ext.outputs.EXT }} + out: ${{ steps.gen-name.outputs.NAME }}.zip + + - name: Create GitHub release + uses: softprops/action-gh-release@v1 + with: + files: ${{ steps.gen-name.outputs.NAME }}.zip