Skip to content

Commit 308c1a7

Browse files
committed
Publish nuget packages from github
1 parent 80ea307 commit 308c1a7

File tree

6 files changed

+122
-5
lines changed

6 files changed

+122
-5
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
env:
2828
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
2929
DOTNET_CLI_TELEMETRY_OPTOUT: 1
30-
run: ./pack.sh -r
30+
run: ./pack.sh -r

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build, Test, Pack, Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v[0-9]+.[0-9]+*
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Setup .NET Core
14+
uses: actions/setup-dotnet@v1
15+
with:
16+
dotnet-version: 2.2.301
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v1.1.0
19+
- name: Build
20+
env:
21+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
22+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
23+
run: ./build.sh -r
24+
- name: Test
25+
env:
26+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
27+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
28+
run: ./test.sh -r
29+
- name: Pack
30+
env:
31+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
32+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
33+
run: ./pack.sh -r
34+
- name: Publish
35+
env:
36+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
37+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
38+
TOKEN: {{ secrets.GITHUB_TOKEN }}
39+
run: publish.sh -r -g

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![](https://github.com/unity-technologies/com.unity.editor.tasks/workflows/Build,%20Test,%20Pack/badge.svg)
2+
13
# About the Tasks package
24

35
Unity.Editor.Tasks is a TPL-based (Task Parallel Library, or System.Threading.Tasks) task management library.

pack.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ while (( "$#" )); do
4545
done
4646

4747
if [[ x"${YAMATO_JOB_ID:-}" != x"" ]]; then
48-
echo 1
4948
YAMATO=1
5049
export GITLAB_CI=1
5150
export CI_COMMIT_TAG="${GIT_TAG:-}"
@@ -80,8 +79,6 @@ EOL
8079
pushd $srcdir >/dev/null 2>&1
8180
count=0
8281
for j in `ls -d *`; do
83-
echo "Packing $j"
84-
8582
pushd $j >/dev/null 2>&1
8683
tgz="$(npm pack -q)"
8784
mv -f $tgz $targetdir/$tgz
@@ -97,6 +94,8 @@ EOL
9794
EOL
9895

9996
count=1
97+
98+
echo "Created package $targetdir/$tgz"
10099
done
101100
popd >/dev/null 2>&1
102101

publish.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/bash -eu
2+
{ set +x; } 2>/dev/null
3+
SOURCE="${BASH_SOURCE[0]}"
4+
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
5+
6+
OS="Mac"
7+
if [[ -e "/c/" ]]; then
8+
OS="Windows"
9+
fi
10+
11+
CONFIGURATION=Release
12+
PUBLIC=""
13+
BUILD=0
14+
UPM=0
15+
UNITYVERSION=2019.2
16+
YAMATO=0
17+
GITHUB=0
18+
19+
while (( "$#" )); do
20+
case "$1" in
21+
-d|--debug)
22+
CONFIGURATION="Debug"
23+
;;
24+
-r|--release)
25+
CONFIGURATION="Release"
26+
;;
27+
-p|--public)
28+
PUBLIC="-p:PublicRelease=true"
29+
;;
30+
-b|--build)
31+
BUILD=1
32+
;;
33+
-u|--upm)
34+
UPM=1
35+
;;
36+
-c)
37+
shift
38+
CONFIGURATION=$1
39+
;;
40+
-g|--github)
41+
GITHUB=1
42+
;;
43+
-*|--*=) # unsupported flags
44+
echo "Error: Unsupported flag $1" >&2
45+
exit 1
46+
;;
47+
esac
48+
shift
49+
done
50+
51+
if [[ x"${YAMATO_JOB_ID:-}" != x"" ]]; then
52+
YAMATO=1
53+
export GITLAB_CI=1
54+
export CI_COMMIT_TAG="${GIT_TAG:-}"
55+
export CI_COMMIT_REF_NAME="${GIT_BRANCH:-}"
56+
fi
57+
58+
if [[ x"${GITHUB_ACTIONS:-}" == x"true" ]]; then
59+
GITHUB=1
60+
fi
61+
62+
if [[ x"$GITHUB" == x"1" ]]; then
63+
64+
if [[ x"${GITHUB_TOKEN:-}" == x"" ]]; then
65+
echo "Can't publish to GitHub without a GITHUB_TOKEN environment variable" >&2
66+
popd >/dev/null 2>&1
67+
exit 1
68+
fi
69+
70+
nuget sources Add -Name "GPR" -Source "https://nuget.pkg.github.com/unity-technologies/index.json" -UserName "unity-technologies" -Password ${GITHUB_TOKEN:-} -NonInteractive >/dev/null 2>&1 || true
71+
for p in "$DIR/build/nuget/**/*.nupkg"; do
72+
echo "nuget push $p -Source \"GPR\""
73+
#nuget push $p -Source "GPR"
74+
done
75+
76+
fi

scripts/Pack-Npm.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Remove-Item "$targetDir\*"
1818
New-Item -itemtype Directory -Path $targetDir -Force -ErrorAction SilentlyContinue
1919

2020
Get-ChildItem -Directory $srcDir | % {
21-
Write-Output "Packing $($_.Name)"
2221

2322
try {
2423
Push-Location (Join-Path $srcDir $_.Name)
@@ -27,6 +26,8 @@ Get-ChildItem -Directory $srcDir | % {
2726
$tgt = Join-Path $targetDir $package
2827
Move-Item $package $tgt -Force
2928
Copy-Item "package.json" (Join-Path $targetDir "$package.json") -Force
29+
30+
Write-Output "Created package $tgt\$package"
3031
} finally {
3132
Pop-Location
3233
}

0 commit comments

Comments
 (0)