ci: ️ Update releases CI

This commit is contained in:
Sergio Gasquez 2022-10-03 12:04:25 +02:00
parent a479626973
commit 278465c33d

View File

@ -1,9 +1,8 @@
name: Continuous Deployment
on:
push:
tags:
- "[v]?[0-9]+.[0-9]+.[0-9]+"
release:
types: [created]
env:
CARGO_TERM_COLOR: always
@ -46,45 +45,20 @@ jobs:
command: build
toolchain: stable
args: --release --target ${{ matrix.job.target }}
- name: Install strip command
shell: bash
run: |
if [[ ${{ matrix.job.target }} == aarch64-unknown-linux-gnu ]]; then
sudo apt update
sudo apt-get install -y binutils-aarch64-linux-gnu
fi
- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.job.target }}/release
- name: Compress (Unix)
if: ${{ matrix.job.runs_on != 'windows-latest' }}
run: zip -j espup-${{ matrix.job.target }}.zip target/${{ matrix.job.target }}/release/espup${{ matrix.job.binary-postfix }}
####### reduce binary size by removing debug symbols #######
BINARY_NAME=espup${{ matrix.job.binary-postfix }}
if [[ ${{ matrix.job.target }} == aarch64-unknown-linux-gnu ]]; then
GCC_PREFIX="aarch64-linux-gnu-"
else
GCC_PREFIX=""
fi
"$GCC_PREFIX"strip $BINARY_NAME
- name: Compress (Windows)
if: ${{ matrix.job.runs_on == 'windows-latest' }}
run: Compress-Archive target/${{ matrix.job.target }}/release/espup${{ matrix.job.binary-postfix }} espup-${{ matrix.job.target }}.zip
########## create tar.gz ##########
RELEASE_NAME=espup-${{ matrix.job.target }}
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME
########## create sha256 ##########
if [[ ${{ runner.os }} == 'Windows' ]]; then
certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256
else
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
fi
- name: Releasing assets
uses: softprops/action-gh-release@v1
- uses: svenstaro/upload-release-action@v2
with:
files: |
target/${{ matrix.job.target }}/release/espup-*.tar.gz
target/${{ matrix.job.target }}/release/espup-*.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: espup-${{ matrix.job.target }}.zip
tag: ${{ github.ref }}
# publish-cargo:
# name: Publishing to Cargo
# runs-on: ubuntu-latest