-
Notifications
You must be signed in to change notification settings - Fork 35
123 lines (108 loc) · 4.37 KB
/
nightly-sdk-generation.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: nightly-sdk-generation
on:
schedule:
- cron: 35 4 * * 1-5
workflow_dispatch: {}
env:
GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
PROVIDER: azure-native
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }}
TRAVIS_OS_NAME: linux
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/..
PUBLISH_REPO_USERNAME: ${{ secrets.OSSRH_USERNAME }}
PUBLISH_REPO_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.JAVA_SIGNING_KEY_ID }}
SIGNING_KEY: ${{ secrets.JAVA_SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.JAVA_SIGNING_PASSWORD }}
ARM_ENVIRONMENT: public
ARM_LOCATION: westus2
PULUMI_API: https://api.pulumi-staging.io
PROVIDER_VERSION: 2.0.0-alpha.0+dev
jobs:
generate-sdk:
# Use a more powerful runner to fix pulumi/pulumi-azure-native#2767
runs-on: pulumi-ubuntu-8core
name: generate-sdk
steps:
# We do a deep checkout so we're able to push later
- name: Checkout Repo
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Install Languages & Frameworks
uses: ./.github/actions/install
with:
skip_dotnet_and_java: "true"
- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_RBAC_SERVICE_PRINCIPAL }}
- name: Cleanup SDK Folder
# Remove the per-language folders but preserve the checked-in go.mod
run: find sdk -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} \;
- name: Preparing Git Branch
run: |
git config --local user.email "[email protected]"
git config --local user.name "pulumi-bot"
git checkout -b generate-sdk/${{ github.run_id }}-${{ github.run_number }}
- name: Commit Empty SDK
run: |-
git add .
git commit -m "Preparing the SDK folder for regeneration"
- name: Update Submodules
run: make update_submodules
- name: Build codegen binaries
run: make codegen
- name: Build Schema + SDKs
run: make local_generate
- name: Git submodule commit hash
id: vars
run: echo "commit-hash=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
working-directory: azure-rest-api-specs
- name: Commit changes
run: |
git add sdk
git commit -m "Regenerating SDKs based on azure-rest-api-specs @ ${{ steps.vars.outputs.commit-hash }}" || echo "ignore commit failure, may be empty"
git add .
git commit -m "Regenerating based on azure-rest-api-specs @ ${{ steps.vars.outputs.commit-hash }}"
git push origin generate-sdk/${{ github.run_id }}-${{ github.run_number }}
- name: Create PR
id: create-pr
uses: repo-sync/[email protected]
with:
destination_branch: master
github_token: ${{ secrets.PULUMI_BOT_TOKEN }}
pr_body: "*Automated PR*"
pr_title: Automated SDK generation @ azure-rest-api-specs ${{
steps.vars.outputs.commit-hash }}
source_branch: generate-sdk/${{ github.run_id }}-${{ github.run_number }}
- name: Install Schema Tools
uses: jaxxstorm/[email protected]
with:
repo: pulumi/schema-tools
- name: Check Schema is Valid
id: schema-tools
shell: bash
run: |
{
echo 'summary<<EOF'
schema-tools compare --provider="azure-native" --new-commit="--local-path=provider/cmd/pulumi-resource-azure-native/schema.json"
echo 'EOF'
} >> "$GITHUB_OUTPUT"
- name: Set AutoMerge
if: steps.create-pr.outputs.has_changed_files && contains(steps.schema-tools.outputs.summary, 'Looking good! No breaking changes found.')
run: gh pr merge ${{ steps.create-pr.outputs.pr_number }} --squash --auto --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
with:
author_name: Failure during automated SDK generation
fields: repo,commit,author,action
status: ${{ job.status }}