|
| 1 | +name: release |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - v*.*.* |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + id-token: write |
| 11 | + |
| 12 | +env: |
| 13 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 14 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 15 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 16 | + NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }} |
| 17 | + NUGET_FEED_URL: https://api.nuget.org/v3/index.json |
| 18 | + PROVIDER: stackit |
| 19 | + PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/.. |
| 20 | + PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget |
| 21 | + PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
| 22 | + PYPI_USERNAME: "__token__" |
| 23 | + PUBLISH_PYPI: true |
| 24 | + PUBLISH_NPM: true |
| 25 | + PUBLISH_NUGET: true |
| 26 | +jobs: |
| 27 | + publish_binary: |
| 28 | + name: publish |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - name: Checkout Repo |
| 32 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 |
| 33 | + - name: Unshallow clone for tags |
| 34 | + run: git fetch --prune --unshallow --tags |
| 35 | + - name: Install Go |
| 36 | + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # tag=v5.5.0 |
| 37 | + with: |
| 38 | + go-version: ${{matrix.goversion}} |
| 39 | + - name: Install pulumictl |
| 40 | + uses: jaxxstorm/action-install-gh-release@6096f2a2bbfee498ced520b6922ac2c06e990ed2 # tag=v2.1.0 |
| 41 | + with: |
| 42 | + repo: pulumi/pulumictl |
| 43 | + - name: Set PreRelease Version |
| 44 | + run: echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic)" >> $GITHUB_ENV |
| 45 | + - uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3.9.1 |
| 46 | + - uses: anchore/sbom-action/download-syft@cee1b8e05ae5b2593a75e197229729eabaa9f8ec # v0.20.2 |
| 47 | + - name: Run GoReleaser |
| 48 | + uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # tag=v6.3.0 |
| 49 | + with: |
| 50 | + args: -p 3 release --clean |
| 51 | + version: '~> v2' |
| 52 | + - name: Create tag |
| 53 | + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # tag=v7.0.1 |
| 54 | + with: |
| 55 | + script: | |
| 56 | + github.rest.git.createRef({ |
| 57 | + owner: context.repo.owner, |
| 58 | + repo: context.repo.repo, |
| 59 | + ref: 'refs/tags/sdk/${{ github.ref_name }}', |
| 60 | + sha: context.sha |
| 61 | + }) |
| 62 | + strategy: |
| 63 | + fail-fast: true |
| 64 | + matrix: |
| 65 | + goversion: |
| 66 | + - 1.22.x |
| 67 | + publish_sdk: |
| 68 | + name: Publish SDKs |
| 69 | + runs-on: ubuntu-latest |
| 70 | + needs: publish_binary |
| 71 | + steps: |
| 72 | + - name: Checkout Repo |
| 73 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 |
| 74 | + - name: Unshallow clone for tags |
| 75 | + run: git fetch --prune --unshallow --tags |
| 76 | + - name: Install Go |
| 77 | + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # tag=v5.5.0 |
| 78 | + with: |
| 79 | + go-version: ${{ matrix.goversion }} |
| 80 | + - name: Install pulumictl |
| 81 | + uses: jaxxstorm/action-install-gh-release@6096f2a2bbfee498ced520b6922ac2c06e990ed2 # tag=v2.1.0 |
| 82 | + with: |
| 83 | + repo: pulumi/pulumictl |
| 84 | + - name: Install Pulumi CLI |
| 85 | + uses: pulumi/action-install-pulumi-cli@b374ceb6168550de27c6eba92e01c1a774040e11 # tag=v2.0.0 |
| 86 | + - name: Setup Node |
| 87 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # tag=v4.4.0 |
| 88 | + with: |
| 89 | + node-version: ${{matrix.nodeversion}} |
| 90 | + registry-url: ${{env.NPM_REGISTRY_URL}} |
| 91 | + - name: Setup DotNet |
| 92 | + uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # tag=v2.1.0 |
| 93 | + with: |
| 94 | + dotnet-version: ${{matrix.dotnetverson}} |
| 95 | + - name: Setup Python |
| 96 | + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # tag=v5.6.0 |
| 97 | + with: |
| 98 | + python-version: ${{matrix.pythonversion}} |
| 99 | + - name: Build SDK |
| 100 | + run: make build_${{ matrix.language }} |
| 101 | + - name: Check worktree clean |
| 102 | + run: | |
| 103 | + git update-index -q --refresh |
| 104 | + if ! git diff-files --quiet; then |
| 105 | + >&2 echo "error: working tree is not clean, aborting!" |
| 106 | + git status |
| 107 | + git diff |
| 108 | + exit 1 |
| 109 | + fi |
| 110 | + - if: ${{ matrix.language == 'python' && env.PUBLISH_PYPI == 'true' }} |
| 111 | + name: Publish package to PyPI |
| 112 | + uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # tag=v1.12.4 |
| 113 | + with: |
| 114 | + user: ${{ env.PYPI_USERNAME }} |
| 115 | + password: ${{ env.PYPI_PASSWORD }} |
| 116 | + packages_dir: ${{github.workspace}}/sdk/python/bin/dist |
| 117 | + - if: ${{ matrix.language == 'nodejs' && env.PUBLISH_NPM == 'true' }} |
| 118 | + uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # tag=v3.1.1 |
| 119 | + with: |
| 120 | + access: "public" |
| 121 | + token: ${{ env.NPM_TOKEN }} |
| 122 | + package: ${{github.workspace}}/sdk/nodejs/bin/package.json |
| 123 | + provenance: true |
| 124 | + - if: ${{ matrix.language == 'dotnet' && env.PUBLISH_NUGET == 'true' }} |
| 125 | + name: publish nuget package |
| 126 | + run: | |
| 127 | + dotnet nuget push ${{github.workspace}}/sdk/dotnet/bin/Debug/*.nupkg -s ${{ env.NUGET_FEED_URL }} -k ${{ env.NUGET_PUBLISH_KEY }} |
| 128 | + echo "done publishing packages" |
| 129 | + strategy: |
| 130 | + fail-fast: true |
| 131 | + matrix: |
| 132 | + dotnetversion: |
| 133 | + - 3.1.301 |
| 134 | + goversion: |
| 135 | + - 1.22.x |
| 136 | + language: |
| 137 | + - nodejs |
| 138 | + - python |
| 139 | + - dotnet |
| 140 | + - go |
| 141 | + nodeversion: |
| 142 | + - 20.x |
| 143 | + pythonversion: |
| 144 | + - "3.9" |
0 commit comments