Skip to content

Commit

Permalink
chore: create binary for multiple distros
Browse files Browse the repository at this point in the history
  • Loading branch information
vandycknick committed Feb 23, 2020
1 parent 72c86d1 commit 1a999a0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
1 change: 0 additions & 1 deletion .envrc

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ jobs:
run: make lint

- name: Build & Package
run: make
run: make package-all

- name: Cleanup
run: rm artifacts/WebTty.Exec.*.nupkg

- name: Get the version
id: get_version
Expand All @@ -54,9 +57,6 @@ jobs:
go get -u github.com/tcnksm/ghr
ghr -t ${{ secrets.GITHUB_TOKEN }} -b 'WebTty release. Look at the changelog for more info' ${{ steps.get_version.outputs.VERSION }} ./artifacts/
- name: Prepare packages
run: rm artifacts/WebTty.Exec.*.nupkg

- name: Push to feedz.io
run: dotnet nuget push artifacts/**/*.nupkg --api-key ${{ secrets.FEEDZ_IO_TOKEN }} --source https://f.feedz.io/nvd/webtty/nuget/index.json --skip-duplicate

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Project specific
.envrc_secrets
wwwroot
.build
artifacts
Expand Down
43 changes: 40 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ WEBTTY_CLIENT := src/WebTty.Hosting/Client
CLI_PROJECT := src/WebTty/WebTty.csproj
CLI_TOOL := webtty
RUNTIME := linux-x64
IS_PACKAGING := False

purge:
rm -rf $(BUILD)
Expand All @@ -33,6 +34,10 @@ default:
package: restore package-exec
dotnet restore --force-evaluate
dotnet build -c $(CONFIGURATION) /property:IsPackaging=True $(CLI_PROJECT)

@echo ""
@echo "\033[0;32mPackaging nuget \033[0m"
@echo "\033[0;32m------------------- \033[0m"
dotnet pack $(CLI_PROJECT) --configuration $(CONFIGURATION) \
--no-build \
--output $(ARTIFACTS) \
Expand All @@ -44,19 +49,45 @@ package-exec:
--output $(ARTIFACTS) \
--version-suffix build.$(shell date "+%Y%m%d%H%M%S")

package-all: package
@echo ""
@echo "\033[0;32mPackaging osx-x64 \033[0m"
@echo "\033[0;32m----------------- \033[0m"
$(MAKE) package-native RUNTIME=osx-x64 IS_PACKAGING=True

@echo ""
@echo "\033[0;32mPackaging linux-x64 \033[0m"
@echo "\033[0;32m------------------- \033[0m"
$(MAKE) package-native RUNTIME=linux-x64 IS_PACKAGING=True

@echo ""
@echo "\033[0;32mPackaging win-x64 \033[0m"
@echo "\033[0;32m----------------- \033[0m"
dotnet publish $(CLI_PROJECT) -c $(CONFIGURATION) \
--output $(BUILD)/publish/win-x64 \
--runtime win-x64 \
/property:PublishTrimmed=true \
/property:PublishSingleFile=true

@mkdir -p $(ARTIFACTS)
@cp $(BUILD)/publish/win-x64/$(CLI_TOOL).exe $(ARTIFACTS)/$(CLI_TOOL).win-x64.exe

@echo ""
@echo "\033[0;32mOutput \033[0m"
@echo "\033[0;32m----------------- \033[0m"
@ls -lh $(ARTIFACTS)

package-native:
dotnet publish $(CLI_PROJECT) -c $(CONFIGURATION) \
--output $(BUILD)/publish/$(RUNTIME) \
--runtime $(RUNTIME) \
/property:IsPackaging=$(IS_PACKAGING) \
/property:PublishTrimmed=true \
/property:PublishSingleFile=true

@mkdir -p $(ARTIFACTS)
@cp $(BUILD)/publish/$(RUNTIME)/$(CLI_TOOL) $(ARTIFACTS)/$(CLI_TOOL).$(RUNTIME)

package-osx:
$(MAKE) package-native RUNTIME=osx-x64

install:
dotnet tool install --global --add-source $(ARTIFACTS) \
--version $$(dotnet minver -t v -a minor -v e) \
Expand Down Expand Up @@ -104,3 +135,9 @@ schema:
--assembly $(shell pwd)/.build/bin/WebTty.Api/Debug/netcoreapp3.1/WebTty.Api.dll \
--namespace WebTty.Api.Messages \
--output $(shell pwd)/$(WEBTTY_CLIENT)/.tmp/messages


chilling:
@echo ""
@echo "\033[0;32m Packaging linux-x64 \033[0m"
@echo "\033[0;32m ------------------- \033[0m"

0 comments on commit 1a999a0

Please sign in to comment.