|
| 1 | +name: release |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - v*.*.* |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + |
| 10 | +env: |
| 11 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 12 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 13 | + NPM_REGISTRY_URL: https://registry.npmjs.org |
| 14 | + NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }} |
| 15 | + NUGET_FEED_URL: https://api.nuget.org/v3/index.json |
| 16 | + PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
| 17 | + PYPI_USERNAME: "__token__" |
| 18 | + PUBLISH_NUGET: true |
| 19 | + PUBLISH_NPM: true |
| 20 | + PUBLISH_PYPI: true |
| 21 | +jobs: |
| 22 | + publish_binary: |
| 23 | + strategy: |
| 24 | + fail-fast: true |
| 25 | + matrix: |
| 26 | + goversion: |
| 27 | + - 1.18.x |
| 28 | + |
| 29 | + name: publish |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v3 |
| 33 | + |
| 34 | + - name: Unshallow clone for tags |
| 35 | + run: git fetch --prune --unshallow --tags |
| 36 | + |
| 37 | + - name: Install Go |
| 38 | + uses: actions/setup-go@v3 |
| 39 | + with: |
| 40 | + go-version: ${{ matrix.goversion }} |
| 41 | + |
| 42 | + - name: Install pulumictl |
| 43 | + |
| 44 | + with: |
| 45 | + repo: pulumi/pulumictl |
| 46 | + |
| 47 | + - name: Set PreRelease Version |
| 48 | + run: echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic)" >> $GITHUB_ENV |
| 49 | + |
| 50 | + - name: Run GoReleaser |
| 51 | + uses: goreleaser/goreleaser-action@v2 |
| 52 | + with: |
| 53 | + args: -p 3 release --rm-dist |
| 54 | + version: latest |
| 55 | + |
| 56 | + publish_sdk: |
| 57 | + name: Publish SDKs |
| 58 | + runs-on: ubuntu-latest |
| 59 | + needs: publish_binary |
| 60 | + strategy: |
| 61 | + fail-fast: true |
| 62 | + matrix: |
| 63 | + dotnetversion: |
| 64 | + - 3.1.301 |
| 65 | + goversion: |
| 66 | + - 1.18.x |
| 67 | + language: |
| 68 | + - nodejs |
| 69 | + - python |
| 70 | + - dotnet |
| 71 | + - go |
| 72 | + nodeversion: |
| 73 | + - 16.x |
| 74 | + pythonversion: |
| 75 | + - "3.9" |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v3 |
| 78 | + |
| 79 | + - name: Unshallow clone for tags |
| 80 | + run: git fetch --prune --unshallow --tags |
| 81 | + |
| 82 | + - uses: actions/setup-go@v3 |
| 83 | + with: |
| 84 | + go-version: ${{ matrix.goversion }} |
| 85 | + |
| 86 | + - name: Install pulumictl |
| 87 | + |
| 88 | + with: |
| 89 | + repo: pulumi/pulumictl |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + - uses: actions/setup-node@v1 |
| 94 | + with: |
| 95 | + node-version: ${{ matrix.nodeversion }} |
| 96 | + registry-url: ${{ env.NPM_REGISTRY_URL }} |
| 97 | + |
| 98 | + - uses: actions/setup-dotnet@v1 |
| 99 | + with: |
| 100 | + dotnet-version: ${{ matrix.dotnetverson }} |
| 101 | + |
| 102 | + - uses: actions/setup-python@v3 |
| 103 | + with: |
| 104 | + python-version: ${{ matrix.pythonversion }} |
| 105 | + |
| 106 | + - name: Build SDK |
| 107 | + run: make build_${{ matrix.language }} |
| 108 | + |
| 109 | + - name: Check worktree clean |
| 110 | + run: | |
| 111 | + git update-index -q --refresh |
| 112 | + if ! git diff-files --quiet; then |
| 113 | + >&2 echo "error: working tree is not clean, aborting!" |
| 114 | + git status |
| 115 | + git diff |
| 116 | + exit 1 |
| 117 | + fi |
| 118 | +
|
| 119 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 120 | + if: ${{ matrix.language == 'python' && env.PUBLISH_PYPI == 'true' }} |
| 121 | + with: |
| 122 | + user: ${{ env.PYPI_USERNAME }} |
| 123 | + password: ${{ env.PYPI_PASSWORD }} |
| 124 | + packages_dir: ${{github.workspace}}/sdk/python/bin/dist |
| 125 | + |
| 126 | + - uses: JS-DevTools/npm-publish@v1 |
| 127 | + if: ${{ matrix.language == 'nodejs' && env.PUBLISH_NPM == 'true' }} |
| 128 | + with: |
| 129 | + access: "public" |
| 130 | + token: ${{ env.NPM_TOKEN }} |
| 131 | + package: ${{github.workspace}}/sdk/nodejs/bin/package.json |
| 132 | + |
| 133 | + - name: publish nuget package |
| 134 | + if: ${{ matrix.language == 'dotnet' && env.PUBLISH_NUGET == 'true' }} |
| 135 | + run: dotnet nuget push ${{github.workspace}}/sdk/dotnet/bin/Debug/*.nupkg -s ${{ env.NUGET_FEED_URL }} -k ${{ env.NUGET_PUBLISH_KEY }} |
0 commit comments