Skip to content

Commit

Permalink
(all) Add CI & config for publishing packages on each master commit
Browse files Browse the repository at this point in the history
  • Loading branch information
perlun committed Feb 11, 2020
1 parent 41cc549 commit 7e18db4
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET Core
name: .NET Core build & test

on: [push]

Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: .NET Core publish packages

on: [push]
# TODO: enable for master branch only when ready.
# branches:
# - master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Get current timestamp
id: timestamp
run: echo "::set-output name=timestamp::$(date +'%Y%m%d-%H%M')"

- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101

#
# Build releases
#
- name: Build linux-x64 release
run: dotnet publish -c Release -r linux-x64 --self-contained true
working-directory: ./Perlang.ConsoleApp

- name: Build osx-x64 release
run: dotnet publish -c Release -r osx-x64 --self-contained true
working-directory: ./Perlang.ConsoleApp

- name: Build win-x64 release
run: dotnet publish -c Release -r win-x64 --self-contained true
working-directory: ./Perlang.ConsoleApp

#
# Create .tar.gz archives
#
- name: Create linux-x64 .tar.gz file
run: tar cvzf ../perlang-${{steps.timestamp.outputs.timestamp}}-${{github.sha}}-linux-x64.tar.gz *
working-directory: ./Perlang.ConsoleApp/bin/Release/netcoreapp3.1/linux-x64/publish

- name: Create osx-x64 .tar.gz file
run: tar cvzf ../perlang-${{steps.timestamp.outputs.timestamp}}-${{github.sha}}-osx-x64.tar.gz *
working-directory: ./Perlang.ConsoleApp/bin/Release/netcoreapp3.1/osx-x64/publish

- name: Create win-x64 .tar.gz file
run: tar cvzf ../perlang-${{steps.timestamp.outputs.timestamp}}-${{github.sha}}-win-x64.tar.gz *
working-directory: ./Perlang.ConsoleApp/bin/Release/netcoreapp3.1/win-x64/publish

#
# Upload files to bintray
#
- name: Upload linux-x64 .tar.gz file to Bintray
uses: gbl08ma/github-action-upload-bintray@master
with:
file: ./Perlang.ConsoleApp/bin/Release/netcoreapp3.1/linux-x64/perlang-${{steps.timestamp.outputs.timestamp}}-${{github.sha}}-linux-x64.tar.gz
api_user: ${{ secrets.BINTRAY_API_USER }}
api_key: ${{ secrets.BINTRAY_API_KEY }}
repository_user: perlang
repository: builds
package: perlang
version: build
publish: 1
calculate_metadata: false

- name: Upload osx-x64 .tar.gz file to Bintray
uses: gbl08ma/github-action-upload-bintray@master
with:
file: ./Perlang.ConsoleApp/bin/Release/netcoreapp3.1/osx-x64/perlang-${{steps.timestamp.outputs.timestamp}}-${{github.sha}}-osx-x64.tar.gz
api_user: ${{ secrets.BINTRAY_API_USER }}
api_key: ${{ secrets.BINTRAY_API_KEY }}
repository_user: perlang
repository: builds
package: perlang
version: build
publish: 1
calculate_metadata: false

- name: Upload win-x64 .tar.gz file to Bintray
uses: gbl08ma/github-action-upload-bintray@master
with:
file: ./Perlang.ConsoleApp/bin/Release/netcoreapp3.1/win-x64/perlang-${{steps.timestamp.outputs.timestamp}}-${{github.sha}}-win-x64.tar.gz
api_user: ${{ secrets.BINTRAY_API_USER }}
api_key: ${{ secrets.BINTRAY_API_KEY }}
repository_user: perlang
repository: builds
package: perlang
version: build
publish: 1
calculate_metadata: false
2 changes: 2 additions & 0 deletions Perlang.ConsoleApp/Perlang.ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PublishTrimmed>true</PublishTrimmed>
<AssemblyName>perlang</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 7e18db4

Please sign in to comment.