-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (93 loc) · 3.73 KB
/
deploy-pack.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# There is no manual way to call this out to run this on tags via UI.
# See: https://github.community/t/workflow-dispatch-from-a-tag-in-actions-tab/130561
name: Tagged Release
on:
push:
tags: ['*']
jobs:
check-if-tag:
name: Set Package Version
runs-on: ubuntu-latest
outputs:
version: ${{steps.deployment.outputs.version}}
steps:
- name: Checkout
run: |
REPOSITORY="https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git"
BRANCH="${GITHUB_REF/#refs\/heads\//}"
git version
git clone --no-checkout ${REPOSITORY} .
git config --local gc.auto 0
git -c protocol.version=2 fetch --no-tags --prune --progress --depth=2 origin +${GITHUB_SHA}:refs/remotes/origin/${BRANCH}
git checkout --progress --force -B $BRANCH refs/remotes/origin/$BRANCH
- name: Set Variables
id: deployment
shell: bash
run: |
if [ $(git describe --exact-match --tags HEAD &> /dev/null; echo $?) == 0 ]; then
echo "::set-output name=VERSION::$(git describe --exact-match --tags HEAD)"
else
echo "fatal: no tag detected for HEAD. Workflow will now stop."
exit 128;
fi
pack-framework:
name: Pack (Framework)
runs-on: windows-latest
needs: [check-if-tag]
defaults:
run:
shell: powershell
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Artifacts Directory
id: artifactsPath
run: echo "::set-output name=NUGET_ARTIFACTS::${{github.workspace}}\artifacts"
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.x"
- name: Build (Framework)
run: dotnet build -c Release LrcParser /p:Version=${{needs.check-if-tag.outputs.version}} /p:GenerateDocumentationFile=true
- name: Pack (Framework)
run: dotnet pack -c Release LrcParser /p:Version=${{needs.check-if-tag.outputs.version}} /p:GenerateDocumentationFile=true -o ${{steps.artifactsPath.outputs.nuget_artifacts}}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: osu-framework
path: ${{steps.artifactsPath.outputs.nuget_artifacts}}\*.nupkg
release:
name: Release
runs-on: ubuntu-latest
needs: [ check-if-tag, pack-framework ]
steps:
- name: Create Artifact Directory
run: mkdir ${{github.workspace}}/artifacts/
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: ${{github.workspace}}/artifacts/
# Artifacts create their own directories. Let's fix that!
# https://github.com/actions/download-artifact#download-all-artifacts
- name: Move Artifacts to root of subdirectory
working-directory: ${{github.workspace}}/artifacts/
run: |
mv -v **/*.nupkg $(pwd)
rm -rfv */
- name: Deploy
run: |
dotnet nuget push ${{github.workspace}}/artifacts/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_AUTH_TOKEN}}
# upload the change to the github release page.
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.RELEASE_TOKEN }}
files: |
${{github.workspace}}/artifacts/*.nupkg
draft: true
body: |
Thank you for using this package. This is a tagged release (${{ env.CURRENT_TAG }}).
- name: Generate changelog
run: |
sudo npm install github-release-notes -g
gren release -T ${{secrets.RELEASE_TOKEN}} --tags=${{env.CURRENT_TAG}} --override