Skip to content

Commit ff1a61e

Browse files
authored
change libgit2sharp.yml to make package
1 parent fbb9ccd commit ff1a61e

File tree

1 file changed

+53
-17
lines changed

1 file changed

+53
-17
lines changed

.github/workflows/libgit2sharp.yml

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,16 @@ name: .NET
22

33
on:
44
push:
5-
branches: [ dotdevelop ]
5+
branches: [ dd/issues/2 ]
66
pull_request:
7-
branches: [ dotdevelop ]
7+
branches: [ dd/issues/2 ]
88

99
jobs:
1010
build:
1111

1212
runs-on: ubuntu-20.04
1313

14-
container:
15-
image: "debian:buster"
16-
1714
steps:
18-
- name: Dependencies
19-
run: |
20-
apt update
21-
apt upgrade -y
22-
apt install git apt-transport-https dirmngr gnupg ca-certificates wget autoconf intltool build-essential sed -y
23-
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
24-
dpkg -i packages-microsoft-prod.deb
25-
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
26-
echo "deb https://download.mono-project.com/repo/debian stable-buster main" > /etc/apt/sources.list.d/mono-official-stable.list
27-
apt update
28-
apt install mono-devel fsharp gtk-sharp2 -y
2915
- uses: actions/checkout@v2
3016
with:
3117
fetch-depth: 0
@@ -37,6 +23,56 @@ jobs:
3723
run: dotnet restore LibGit2Sharp.sln
3824
- name: Build
3925
run: dotnet build --no-restore LibGit2Sharp.sln
26+
- name: Pack
27+
run: |
28+
echo running on branch $(echo ${GITHUB_SHA} | cut -c1-10)
29+
dotnet pack --include-symbols -c Release LibGit2Sharp.sln
30+
ls ./bin/Packages/Release/
31+
32+
- name: Short Sha
33+
id: short-sha
34+
run: echo "::set-output name=short_sha::$(echo ${GITHUB_SHA} | cut -c1-10)"
35+
36+
- name: Push generated package to GitHub registry
37+
run: dotnet nuget push ./bin/Packages/Release/LibGit2Sharp.0.27.0-preview-g${{steps.short-sha.outputs.short_sha}}.nupkg --source https://nuget.pkg.github.com/dotdevelop --api-key ${{github.token}} --skip-duplicate --no-symbols true
38+
39+
- name: Create Release
40+
id: create_release
41+
uses: actions/create-release@v1
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
with:
45+
tag_name: ${{ github.ref }}
46+
release_name: Release ${{ github.ref }}
47+
draft: true
48+
prerelease: true
49+
- name: Upload Release Asset
50+
id: upload-release-asset
51+
uses: actions/upload-release-asset@v1
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
SHORT_SHA: ${{ steps.short-sha.outputs.short_sha }}
55+
with:
56+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
57+
asset_path: ./bin/Packages/Release/LibGit2Sharp.0.27.0-preview-g${{steps.short-sha.outputs.short_sha}}.nupkg
58+
asset_name: LibGit2Sharp.0.27.0-preview-g${{steps.short-sha.outputs.short_sha}}.nupkg
59+
asset_content_type: application/nupkg
60+
61+
test:
62+
runs-on: ubuntu-20.04
63+
64+
steps:
65+
- uses: actions/checkout@v2
66+
with:
67+
fetch-depth: 0
68+
- name: Setup .NET
69+
uses: actions/setup-dotnet@v1
70+
with:
71+
dotnet-version: 3.1.401
72+
- name: Restore dependencies
73+
run: dotnet restore LibGit2Sharp.sln
74+
- name: Build
75+
run: dotnet build --no-restore LibGit2Sharp.sln
76+
4077
- name: Test
4178
run: dotnet test --no-build --verbosity normal LibGit2Sharp.sln
42-

0 commit comments

Comments
 (0)