Skip to content

Commit

Permalink
Fix packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
haimgel committed Nov 11, 2024
1 parent 520143e commit 5e65154
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
crate_metadata:
name: Extract crate metadata
Expand Down Expand Up @@ -70,7 +74,8 @@ jobs:
mkdir -p "$PACKAGE_DIR"
PACKAGE_NAME="display_switch-v${{ needs.crate_metadata.outputs.version }}-${{ matrix.job.short_target }}.zip"
PACKAGE_FILE="$PACKAGE_DIR/$PACKAGE_NAME"
zip -j $PACKAGE_FILE target/release/display_switch* README.md LICENSE
shopt -s extglob # To match the filename below (without any debug symbols)
zip -j $PACKAGE_FILE target/release/display_switch?(.exe) README.md LICENSE
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_OUTPUT
echo "PACKAGE_FILE=$PACKAGE_FILE" >> $GITHUB_OUTPUT
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ BINARY := display_switch
INTEL_ARCH := x86_64-apple-darwin
ARM_ARCH := aarch64-apple-darwin
UNAME_S := $(shell uname -s)
VERSION := $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')

# Targets for different build modes
.PHONY: build-debug build-release all test clean setup-$(INTEL_ARCH) setup-$(ARM_ARCH)
Expand Down Expand Up @@ -58,3 +59,10 @@ test:

clean:
cargo clean

package-release: build-release
mkdir -p "target/package"
zip -j target/package/$(BINARY)-v$(VERSION)-$(PLATFORM).zip target/release/$(BINARY)* README.md LICENSE
cp README.md LICENSE target/release/$(BINARY) target/package
cd target/package && zip -r $(BINARY)-v$(VERSION)-$(PLATFORM).zip $(BINARY) README.md LICENSE
echo "$(BINARY)-v$(VERSION)-$(PLATFORM).zip"

0 comments on commit 5e65154

Please # to comment.