Skip to content

Update release workflow #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches:
- master
Expand Down Expand Up @@ -59,16 +59,16 @@ jobs:
# target: i686-pc-windows-msvc

steps:
- name: Strip release binary (linux and macos)
if: matrix.build == 'x86_64-windows' # Windows is missing some dependencies
- name: Set Git config. (windows only)
if: contains(matrix.build, 'windows') # Windows is missing some dependencies
run: |
git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m"
git config --global pack.threads "1"
git config --global pack.deltaCacheSize "512m"

- name: Install python 3.10 for windows
if: matrix.build == 'x86_64-windows' # Windows is missing some dependencies
if: contains(matrix.build, 'windows') # Windows is missing some dependencies
uses: actions/setup-python@v4
with:
python-version: '3.10'
Expand Down Expand Up @@ -100,32 +100,19 @@ jobs:
command: build
args: --release --locked --target ${{ matrix.target }}

- name: Strip release binary (linux and macos)
if: matrix.build == 'x86_64-linux' || matrix.build == 'x86_64-macos'
run: strip "target/${{ matrix.target }}/release/$BIN_NAME"

- name: Strip release binary (arm)
if: matrix.build == 'aarch64-linux'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
rustembedded/cross:${{ matrix.target }} \
aarch64-linux-gnu-strip \
/target/${{ matrix.target }}/release/$BIN_NAME

- name: Calculate tag name
if: matrix.build == 'x86_64-linux'
if: contains(matrix.build, 'linux')
run: |
name=dev
if [[ $GITHUB_REF == refs/tags/v* ]]; then
name=${GITHUB_REF:10}
if [[ ${GITHUB_REF} =~ refs/tags/[0-9]+.[0-9]+.[0-9]+ ]]; then
name=${GITHUB_REF#refs/tags/}
fi
echo ::set-output name=val::$name
echo TAG=$name >> $GITHUB_ENV
id: tagname

- name: Build deb package (linux only)
if: matrix.build == 'x86_64-linux'
if: contains(matrix.build, 'linux')
run: |
cargo install cargo-deb
cargo deb --target ${{ matrix.target }} --deb-version ${TAG}
Expand All @@ -134,13 +121,13 @@ jobs:
shell: bash
run: |
mkdir dist
if [ "${{ matrix.os }}" = "windows-2019" ]; then
if [[ "${{ matrix.build }}" =~ "windows" ]]; then
cp "target/${{ matrix.target }}/release/$BIN_NAME.exe" "dist/"
else
cp "target/${{ matrix.target }}/release/$BIN_NAME" "dist/"
fi

if [ "${{ matrix.build }}" = "x86_64-linux" ]; then
if [[ "${{ matrix.build }}" =~ "linux" ]]; then
cp "target/${{ matrix.target }}/debian/rustscan_${TAG}_amd64.deb" "dist/"
fi
- uses: actions/upload-artifact@v2.2.4
Expand Down Expand Up @@ -168,8 +155,8 @@ jobs:
- name: Calculate tag name
run: |
name=dev
if [[ $GITHUB_REF == refs/tags/v* ]]; then
name=${GITHUB_REF:10}
if [[ ${GITHUB_REF} =~ refs/tags/[0-9]+.[0-9]+.[0-9]+ ]]; then
name=${GITHUB_REF#refs/tags/}
fi
echo ::set-output name=val::$name
echo TAG=$name >> $GITHUB_ENV
Expand All @@ -194,7 +181,7 @@ jobs:
mv bins-$platform/$BIN_NAME$exe tmp/$pkgname
chmod +x tmp/$pkgname/$BIN_NAME$exe

if [[ $platform == "x86_64-linux" ]]; then
if [[ $platform =~ "linux" ]]; then
mv "bins-$platform/rustscan_${TAG}_amd64.deb" dist/
fi

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ section = "rust"
[profile.release]
lto = true
panic = 'abort'
strip = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
Expand Down