-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (101 loc) · 3.55 KB
/
Copy pathpublish_sdk.yml
File metadata and controls
109 lines (101 loc) · 3.55 KB
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
104
105
106
107
108
109
name: Publish SDK
on:
push:
branches:
- master
paths:
- 'src/**'
jobs:
release_draft:
name: Create release draft
runs-on: ubuntu-latest
outputs:
release_body: ${{ steps.create_release_draft.outputs.body }}
release_tag: ${{ steps.create_release_draft.outputs.tag_name }}
release_html_url: ${{ steps.create_release_draft.outputs.html_url }}
release_id: ${{ steps.create_release_draft.outputs.id }}
steps:
- name: "Create release draft"
id: create_release_draft
uses: release-drafter/release-drafter@v6
with:
commitish: master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build and publish SDK package
runs-on: ubuntu-latest
needs: release_draft
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set nuget credentials
run: |
cp ../.github/nuget.config nuget.config
sed -i "s|</configuration>|<packageSourceCredentials><DataboxNugets><add key=\"Username\" value=\"PAT\" /><add key=\"ClearTextPassword\" value=\"${{ secrets.PACKAGES_PUBLISH_TOKEN }}\" /></DataboxNugets></packageSourceCredentials></configuration>|" nuget.config
working-directory: src
- name: Build
run: |
dotnet build -c Release
dotnet test -c Release
working-directory: src
- name: Pack
run: dotnet pack src/Databox/Databox.csproj -o ${{ runner.temp }} -c Release --no-build
working-directory: src
- name: Push
run: dotnet nuget push ${{ runner.temp }}/Databox.${{needs.release_draft.outputs.release_tag}}.nupkg --source https://nuget.pkg.github.com/databox/index.json --api-key "${{ secrets.PACKAGES_PUBLISH_TOKEN }}"
working-directory: src
release_publish:
name: Publish release
runs-on: ubuntu-latest
needs:
- release_draft
- build
steps:
- name: "Publish release"
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.release_draft.outputs.release_id }}
post_slack_job:
name: Post info to Slack in #engeering-releases channel
needs:
- release_draft
- release_publish
runs-on: ubuntu-latest
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
steps:
- name: Format to Slack msg
uses: LoveToKnow/slackify-markdown-action@v1.0.0
id: slack_msg_converter
with:
text: ${{needs.release_draft.outputs.release_body}}
- name: Post to a Slack channel
if: success()
id: slack
uses: slackapi/slack-github-action@v1.23.0
with:
channel-id: 'C027FC31SVD'
payload: |
{
"text": "New version post",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "New <${{ github.server_url }}/${{ github.repository }}|`${{ github.repository }}`> release <${{ github.server_url }}/${{ github.repository }}/releases/${{ needs.create_release_draft_job.outputs.release_tag }}|${{ needs.create_release_draft_job.outputs.release_tag }}> is available! :tada:"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{toJSON(steps.slack_msg_converter.outputs.text)}}
}
}
]
}