|
| 1 | +# WARNING: DO NOT EDIT! |
| 2 | +# |
| 3 | +# This file was generated by plugin_template, and is managed by it. Please use |
| 4 | +# './plugin-template --github pulp_npm' to update this file. |
| 5 | +# |
| 6 | +# For more info visit https://github.com/pulp/plugin_template |
| 7 | + |
| 8 | +--- |
| 9 | +name: "Npm Publish Release" |
| 10 | +on: |
| 11 | + push: |
| 12 | + tags: |
| 13 | + - "[0-9]+.[0-9]+.[0-9]+" |
| 14 | + |
| 15 | +defaults: |
| 16 | + run: |
| 17 | + working-directory: "pulp_npm" |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + uses: "./.github/workflows/build.yml" |
| 22 | + |
| 23 | + build-bindings-docs: |
| 24 | + needs: |
| 25 | + - "build" |
| 26 | + runs-on: "ubuntu-latest" |
| 27 | + # Install scripts expect TEST to be set, 'docs' is most appropriate even though we don't run tests |
| 28 | + env: |
| 29 | + TEST: "docs" |
| 30 | + steps: |
| 31 | + - uses: "actions/checkout@v4" |
| 32 | + with: |
| 33 | + fetch-depth: 1 |
| 34 | + path: "pulp_npm" |
| 35 | + |
| 36 | + - uses: "actions/checkout@v4" |
| 37 | + with: |
| 38 | + fetch-depth: 1 |
| 39 | + repository: "pulp/pulp-openapi-generator" |
| 40 | + path: "pulp-openapi-generator" |
| 41 | + |
| 42 | + - uses: "actions/setup-python@v4" |
| 43 | + with: |
| 44 | + python-version: "3.8" |
| 45 | + |
| 46 | + - uses: "actions/download-artifact@v3" |
| 47 | + with: |
| 48 | + name: "plugin_package" |
| 49 | + path: "pulp_npm/dist/" |
| 50 | + - uses: ruby/setup-ruby@v1 |
| 51 | + with: |
| 52 | + ruby-version: "2.6" |
| 53 | + |
| 54 | + - name: "Install python dependencies" |
| 55 | + run: | |
| 56 | + echo ::group::PYDEPS |
| 57 | + pip install towncrier twine wheel httpie docker netaddr boto3 ansible mkdocs |
| 58 | + echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulp_npm/.ci/assets/httpie/" >> $GITHUB_ENV |
| 59 | + echo ::endgroup:: |
| 60 | +
|
| 61 | + # Building the bindings and docs requires accessing the OpenAPI specs endpoint, so we need to |
| 62 | + # setup the Pulp instance. |
| 63 | + - name: "Before Install" |
| 64 | + run: | |
| 65 | + .github/workflows/scripts/before_install.sh |
| 66 | + shell: "bash" |
| 67 | + env: |
| 68 | + PY_COLORS: "1" |
| 69 | + ANSIBLE_FORCE_COLOR: "1" |
| 70 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 71 | + GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" |
| 72 | + |
| 73 | + - name: "Install" |
| 74 | + run: | |
| 75 | + .github/workflows/scripts/install.sh |
| 76 | + shell: "bash" |
| 77 | + env: |
| 78 | + PY_COLORS: "1" |
| 79 | + ANSIBLE_FORCE_COLOR: "1" |
| 80 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 81 | + GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" |
| 82 | + |
| 83 | + - name: "Install Python client" |
| 84 | + run: | |
| 85 | + .github/workflows/scripts/install_python_client.sh |
| 86 | + shell: "bash" |
| 87 | + - name: "Install Ruby client" |
| 88 | + run: | |
| 89 | + .github/workflows/scripts/install_ruby_client.sh |
| 90 | + shell: "bash" |
| 91 | + - name: "Upload python client packages" |
| 92 | + uses: "actions/upload-artifact@v3" |
| 93 | + with: |
| 94 | + name: "python-client.tar" |
| 95 | + path: "pulp_npm/npm-python-client.tar" |
| 96 | + if-no-files-found: "error" |
| 97 | + |
| 98 | + - name: "Upload python client docs" |
| 99 | + uses: "actions/upload-artifact@v3" |
| 100 | + with: |
| 101 | + name: "python-client-docs.tar" |
| 102 | + path: "pulp_npm/npm-python-client-docs.tar" |
| 103 | + if-no-files-found: "error" |
| 104 | + - name: "Upload ruby client packages" |
| 105 | + uses: "actions/upload-artifact@v3" |
| 106 | + with: |
| 107 | + name: "ruby-client.tar" |
| 108 | + path: "pulp_npm/npm-ruby-client.tar" |
| 109 | + if-no-files-found: "error" |
| 110 | + - name: Build docs |
| 111 | + run: | |
| 112 | + export DJANGO_SETTINGS_MODULE=pulpcore.app.settings |
| 113 | + export PULP_SETTINGS=$PWD/.ci/ansible/settings/settings.py |
| 114 | + make -C docs/ PULP_URL="https://pulp" diagrams html |
| 115 | + tar -cvf docs/docs.tar docs/_build |
| 116 | +
|
| 117 | + - name: "Upload built docs" |
| 118 | + uses: actions/upload-artifact@v3 |
| 119 | + with: |
| 120 | + name: "docs.tar" |
| 121 | + path: "pulp_npm/docs/docs.tar" |
| 122 | + |
| 123 | + - name: "Logs" |
| 124 | + if: always() |
| 125 | + run: | |
| 126 | + echo "Need to debug? Please check: https://github.com/marketplace/actions/debugging-with-tmate" |
| 127 | + http --timeout 30 --check-status --pretty format --print hb "https://pulp${PULP_API_ROOT}api/v3/status/" || true |
| 128 | + docker images || true |
| 129 | + docker ps -a || true |
| 130 | + docker logs pulp || true |
| 131 | + docker exec pulp ls -latr /etc/yum.repos.d/ || true |
| 132 | + docker exec pulp cat /etc/yum.repos.d/* || true |
| 133 | + docker exec pulp bash -c "pip3 list && pip3 install pipdeptree && pipdeptree" |
| 134 | + publish-package: |
| 135 | + runs-on: "ubuntu-latest" |
| 136 | + needs: |
| 137 | + - "build-bindings-docs" |
| 138 | + |
| 139 | + env: |
| 140 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 141 | + |
| 142 | + steps: |
| 143 | + - uses: "actions/checkout@v4" |
| 144 | + with: |
| 145 | + fetch-depth: 1 |
| 146 | + path: "pulp_npm" |
| 147 | + |
| 148 | + - uses: "actions/download-artifact@v3" |
| 149 | + with: |
| 150 | + name: "plugin_package" |
| 151 | + path: "pulp_npm/dist/" |
| 152 | + |
| 153 | + - uses: "actions/setup-python@v4" |
| 154 | + with: |
| 155 | + python-version: "3.8" |
| 156 | + |
| 157 | + - name: "Install python dependencies" |
| 158 | + run: | |
| 159 | + echo ::group::PYDEPS |
| 160 | + pip install twine |
| 161 | + echo ::endgroup:: |
| 162 | +
|
| 163 | + - name: "Setting secrets" |
| 164 | + run: | |
| 165 | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" |
| 166 | + env: |
| 167 | + SECRETS_CONTEXT: "${{ toJson(secrets) }}" |
| 168 | + |
| 169 | + - name: "Deploy plugin to pypi" |
| 170 | + run: | |
| 171 | + .github/workflows/scripts/publish_plugin_pypi.sh ${{ github.ref_name }} |
| 172 | + publish-python-bindings: |
| 173 | + runs-on: "ubuntu-latest" |
| 174 | + needs: |
| 175 | + - "build-bindings-docs" |
| 176 | + |
| 177 | + env: |
| 178 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 179 | + |
| 180 | + steps: |
| 181 | + - uses: "actions/checkout@v4" |
| 182 | + with: |
| 183 | + fetch-depth: 1 |
| 184 | + path: "pulp_npm" |
| 185 | + |
| 186 | + - name: "Download Python client" |
| 187 | + uses: "actions/download-artifact@v3" |
| 188 | + with: |
| 189 | + name: "python-client.tar" |
| 190 | + path: "pulp_npm/" |
| 191 | + |
| 192 | + - name: "Untar python client packages" |
| 193 | + run: | |
| 194 | + tar -xvf npm-python-client.tar |
| 195 | +
|
| 196 | + - uses: "actions/setup-python@v4" |
| 197 | + with: |
| 198 | + python-version: "3.8" |
| 199 | + |
| 200 | + - name: "Install python dependencies" |
| 201 | + run: | |
| 202 | + echo ::group::PYDEPS |
| 203 | + pip install twine |
| 204 | + echo ::endgroup:: |
| 205 | +
|
| 206 | + - name: "Setting secrets" |
| 207 | + run: | |
| 208 | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" |
| 209 | + env: |
| 210 | + SECRETS_CONTEXT: "${{ toJson(secrets) }}" |
| 211 | + |
| 212 | + - name: "Publish client to pypi" |
| 213 | + run: | |
| 214 | + bash .github/workflows/scripts/publish_client_pypi.sh ${{ github.ref_name }} |
| 215 | + publish-ruby-bindings: |
| 216 | + runs-on: "ubuntu-latest" |
| 217 | + needs: |
| 218 | + - "build-bindings-docs" |
| 219 | + |
| 220 | + env: |
| 221 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 222 | + |
| 223 | + steps: |
| 224 | + - uses: "actions/checkout@v4" |
| 225 | + with: |
| 226 | + fetch-depth: 1 |
| 227 | + path: "pulp_npm" |
| 228 | + |
| 229 | + - name: "Download Ruby client" |
| 230 | + uses: "actions/download-artifact@v3" |
| 231 | + with: |
| 232 | + name: "ruby-client.tar" |
| 233 | + path: "pulp_npm/" |
| 234 | + |
| 235 | + - name: "Untar Ruby client packages" |
| 236 | + run: | |
| 237 | + tar -xvf npm-ruby-client.tar |
| 238 | +
|
| 239 | + - uses: ruby/setup-ruby@v1 |
| 240 | + with: |
| 241 | + ruby-version: "2.6" |
| 242 | + |
| 243 | + - name: "Setting secrets" |
| 244 | + run: | |
| 245 | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" |
| 246 | + env: |
| 247 | + SECRETS_CONTEXT: "${{ toJson(secrets) }}" |
| 248 | + |
| 249 | + - name: "Publish client to rubygems" |
| 250 | + run: | |
| 251 | + bash .github/workflows/scripts/publish_client_gem.sh ${{ github.ref_name }} |
| 252 | + publish-docs: |
| 253 | + runs-on: "ubuntu-latest" |
| 254 | + needs: |
| 255 | + - "build-bindings-docs" |
| 256 | + |
| 257 | + env: |
| 258 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 259 | + |
| 260 | + steps: |
| 261 | + - uses: "actions/checkout@v4" |
| 262 | + with: |
| 263 | + fetch-depth: 1 |
| 264 | + path: "pulp_npm" |
| 265 | + |
| 266 | + - uses: "actions/setup-python@v4" |
| 267 | + with: |
| 268 | + python-version: "3.8" |
| 269 | + |
| 270 | + - name: "Install python dependencies" |
| 271 | + run: | |
| 272 | + echo ::group::PYDEPS |
| 273 | + pip install 'packaging~=21.3' requests |
| 274 | + echo ::endgroup:: |
| 275 | +
|
| 276 | + - name: "Setting secrets" |
| 277 | + run: | |
| 278 | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" |
| 279 | + env: |
| 280 | + SECRETS_CONTEXT: "${{ toJson(secrets) }}" |
| 281 | + |
| 282 | + - name: "Download built docs" |
| 283 | + uses: "actions/download-artifact@v3" |
| 284 | + with: |
| 285 | + name: "docs.tar" |
| 286 | + path: "pulp_npm/" |
| 287 | + |
| 288 | + - name: "Download Python client docs" |
| 289 | + uses: "actions/download-artifact@v3" |
| 290 | + with: |
| 291 | + name: "python-client-docs.tar" |
| 292 | + path: "pulp_npm/" |
| 293 | + |
| 294 | + - name: "Publish docs to pulpproject.org" |
| 295 | + run: | |
| 296 | + tar -xvf docs.tar |
| 297 | + .github/workflows/scripts/publish_docs.sh tag ${{ github.ref_name }} |
| 298 | +
|
| 299 | + create-gh-release: |
| 300 | + runs-on: "ubuntu-latest" |
| 301 | + needs: |
| 302 | + - "build-bindings-docs" |
| 303 | + - "publish-package" |
| 304 | + - "publish-python-bindings" |
| 305 | + - "publish-ruby-bindings" |
| 306 | + - "publish-docs" |
| 307 | + |
| 308 | + steps: |
| 309 | + - name: "Create release on GitHub" |
| 310 | + uses: "actions/github-script@v7" |
| 311 | + env: |
| 312 | + TAG_NAME: "${{ github.ref_name }}" |
| 313 | + with: |
| 314 | + script: | |
| 315 | + const { TAG_NAME } = process.env; |
| 316 | +
|
| 317 | + await github.rest.repos.createRelease({ |
| 318 | + owner: context.repo.owner, |
| 319 | + repo: context.repo.repo, |
| 320 | + tag_name: TAG_NAME, |
| 321 | + make_latest: "legacy", |
| 322 | + }); |
0 commit comments