-
Notifications
You must be signed in to change notification settings - Fork 123
134 lines (128 loc) · 5.21 KB
/
publish-provider-update.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
124
125
126
127
128
129
130
131
132
133
134
env:
GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
# The path within the Pulumi provider repo to the schema file.
PROVIDER_SCHEMA_PATH: ${{ github.event.client_payload.schema-path }}
# The short-name of the provider, used in URL names. This is effectively the provider's
# identity in the Pulumi registry right now.
PROVIDER_SHORT_NAME: ${{ github.event.client_payload.project-shortname }}
# The git tag that the provider is released with.
#
# This is only meaningful when the provider is based on a GitHub repo.
PROVIDER_VERSION: ${{ github.event.client_payload.ref }}
# A public URL which hosts the provider's Pulumi schema.
#
# This URL must be durable, as it will be required available to build the registry.
PROVIDER_SCHEMA_URL: ${{ github.event.client_payload.schema-url }}
# A public URL which hosts the provider's _index.md file.
#
# This URL must be durable, as it will be required available to build the registry.
PROVIDER_INDEX_URL: ${{ github.event.client_payload.index-url }}
name: provider docs build
on:
repository_dispatch:
types:
# An update for a provider that is hosted in a Pulumi repo.
#
# Required inputs are:
# - PROVIDER_SHORT_NAME
# - PROVIDER_VERSION
#
# Optional inputs are:
# - PROVIDER_SCHEMA_PATH
- resource-provider
# An update for a provider that is hosted opaquely - where we don't assume a backing
# GH repo.
#
# Required inputs are:
# - PROVIDER_SHORT_NAME
# - PROVIDER_SCHEMA_URL
# - PROVIDER_INDEX_URL
- push-provider-update
jobs:
unknown-event-type:
if: ${{ github.event.action != 'resource-provider' && github.event.action != 'push-provider-update' }}
runs-on: ubuntu-latest
steps:
- run: printf "Unknown event type '%s'\n" "${{ github.event.action}}"
- name: fail
run: exit 1
build-resource-provider-docs:
if: ${{ github.event.action == 'resource-provider' }}
runs-on: ubuntu-latest
steps:
- run: echo "Building ${{ env.PROVIDER_SHORT_NAME }} docs @ ${{ env.PROVIDER_VERSION }}"
- name: checkout registry repo
uses: actions/checkout@v4
- name: Build resourcedocsgen
run: go build -C tools/resourcedocsgen
- name: Generate Package Metadata
run: >-
./tools/resourcedocsgen/resourcedocsgen metadata from-github
--providerName=${{ env.PROVIDER_SHORT_NAME }}
--repoSlug pulumi/pulumi-${{ env.PROVIDER_SHORT_NAME }}
--schemaFile="${{ env.PROVIDER_SCHEMA_PATH }}"
--version="${{ env.PROVIDER_VERSION }}"
--publisher Pulumi
- name: git status
run: git status && git diff
- name: Create registry PR
uses: ./.github/actions/new-provider-version-pr
with:
github_token: ${{ secrets.PULUMI_BOT_TOKEN }}
provider_short_name: ${{ env.PROVIDER_SHORT_NAME }}
provider_version: ${{ env.PROVIDER_VERSION }}
build-provider-docs:
if: ${{ github.event.action == 'push-provider-update' }}
runs-on: ubuntu-latest
steps:
- name: Validate Inputs
run: |
should_not_set() {
if ! [ "${!1}" = "" ]; then
echo "$1 is not respected, and should not be set"
exit 1
fi
}
PROVIDER_VERSION="${{ env.PROVIDER_VERSION }}" should_not_set PROVIDER_VERSION
PROVIDER_SCHEMA_PATH="${{ env.PROVIDER_SCHEMA_PATH }}" should_not_set PROVIDER_SCHEMA_PATH
- name: Fetch upstream schema
run: |
curl "${{ env.PROVIDER_SCHEMA_URL }}" > ${{ runner.temp }}/schema.json
echo "PROVIDER_VERSION=$(jq .version --raw-output --exit-status ${{ runner.temp }}/schema.json)" >> "$GITHUB_ENV"
- run: echo "Building ${{ env.PROVIDER_SHORT_NAME }} docs @ ${{ env.PROVIDER_VERSION }}"
- name: checkout registry repo
uses: actions/checkout@v4
- name: Build resourcedocsgen
run: go build -C tools/resourcedocsgen
- name: Generate Package Metadata
run: >-
./tools/resourcedocsgen/resourcedocsgen metadata from-urls
--providerName "${{ env.PROVIDER_SHORT_NAME }}"
--schemaFileURL "${{ env.PROVIDER_SCHEMA_URL }}"
--indexFileURL "${{ env.PROVIDER_INDEX_URL }}"
- name: git status
run: git status && git diff
- name: Create registry PR
uses: ./.github/actions/new-provider-version-pr
with:
github_token: ${{ secrets.PULUMI_BOT_TOKEN }}
provider_short_name: ${{ env.PROVIDER_SHORT_NAME }}
provider_version: ${{ env.PROVIDER_VERSION }}
notify:
if: failure()
name: Send slack notification
runs-on: ubuntu-latest
needs:
- build-resource-provider-docs
- build-provider-docs
- unknown-event-type
steps:
- name: Slack Notification
uses: docker://sholung/action-slack-notify:v2.3.0
env:
SLACK_CHANNEL: registry-ops
SLACK_COLOR: "#F54242"
SLACK_MESSAGE: "provider docs build failure in pulumi/registry repo :meow_sad:"
SLACK_USERNAME: registrybot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON: https://www.pulumi.com/logos/brand/avatar-on-white.png