Skip to content

nightly-sdk-generation #1219

nightly-sdk-generation

nightly-sdk-generation #1219

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 "bot@pulumi.com"
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/pull-request@v2.12.1
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/action-install-gh-release@v1.11.0
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 }}