-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (76 loc) · 2.61 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: publish
on:
push:
branches:
- 'master'
- 'develop'
- 'release/*'
- 'feature/*'
- 'fix/*'
jobs:
build:
runs-on: self-hosted
environment: CommonEnv
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
REPO_URL: ${{github.repositoryUrl}}
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core SDK 7
uses: actions/[email protected]
with:
dotnet-version: '7.0.x'
- name: Restore .Net
run: dotnet restore src
- name: Configure version
run: |
git fetch --unshallow
CURRENT_TAG_VERSION=$(git tag --points-at HEAD)
echo $CURRENT_TAG_VERSION
if [ -z "$CURRENT_TAG_VERSION" ]
then
git remote set-url origin https://$GITHUB_TOKEN@${REPO_URL:6}
CURRENT_TAG_VERSION=$(python3 getVersion.py ./VERSION $ARA_BUILD_DATA_PATH/buildVersionV1.txt)
git tag $CURRENT_TAG_VERSION
git push origin --tags
fi
sed -i -e "s/\(<Version>\)\(.*\)\(<\/Version>\)/\1$CURRENT_TAG_VERSION\3/" src/AsyncReactAwait/AsyncReactAwait.csproj
echo "newVersion=$CURRENT_TAG_VERSION"
echo "newVersion=$CURRENT_TAG_VERSION" >> $GITHUB_ENV
- name: Test
run: dotnet test src --verbosity normal
- name: Build
run: dotnet build src/AsyncReactAwait/AsyncReactAwait.csproj --no-dependencies --output src/build
- name: Publish package to GitHub
if: github.ref == 'refs/heads/master'
run: |
dotnet nuget push src/build/*.nupkg --api-key ${{secrets.PAT_TOKEN}} --source github
- name: Publish package to Nuget
if: github.ref == 'refs/heads/master'
run: |
dotnet nuget push src/build/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
- name: Zip build
run: zip AsyncReactAwait.zip src/build/AsyncReactAwait.dll src/build/AsyncReactAwait.xml
- name: Tag non-release
if: github.ref != 'refs/heads/master'
run: |
lastTag=$(git describe --tags --abbrev=0)
currentTag=$(git tag --contains)
if [ "$lastTag" != "$currentTag" ]
then
echo "New tag ${{ env.newVersion }}"
git tag ${{ env.newVersion }}
git push --tags
fi
- name: Create Release
uses: ncipollo/[email protected]
with:
tag: ${{ env.newVersion }}
name: Release ${{ env.newVersion }}
artifacts: "src/build/*.nupkg, AsyncReactAwait.zip"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Expose as artifact
uses: actions/[email protected]
with:
name: Build
path: src/build