Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 25 additions & 31 deletions templates/github/.github/workflows/publish.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,21 @@ jobs:
runs-on: "ubuntu-latest"
needs:
- "build"

env:
GITHUB_TOKEN: "{{ '${{ secrets.GITHUB_TOKEN }}' }}"
environment:
name: "pypi"
url: "https://pypi.org/p/{{ plugin_name | dash }}"
Comment on lines +33 to +35
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This environment is the new GH thing for describing the "environment for a deployment" and the deployment in our case being the "upload to pypi".
You specify url here and not for the bindings. Is it needed or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my googling no it isn't needed. It's set in the example on PyPI, but I think it's just extra context for where the environment is publishing. The bindings could contain multiple projects so one url wouldn't be "correct".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sad, but I'll leave it to your discretion.

permissions:
id-token: "write"

steps:
{{ checkout(depth=1, path=plugin_name) | indent(6) }}

- uses: "actions/download-artifact@v4"
with:
name: "plugin_package"
path: "{{ plugin_name }}/dist/"

{{ setup_python() | indent(6) }}
path: "dist/"

{{ install_python_deps(["twine"]) | indent(6) }}
- name: "Publish package to PyPI"
uses: pypa/gh-action-pypi-publish@release/v1

{{ set_secrets() | indent(6) }}

- name: "Deploy plugin to pypi"
run: |
.github/workflows/scripts/publish_plugin_pypi.sh {{ "${{ github.ref_name }}" }}
{%- endif %}

{%- if plugins %}
Expand All @@ -59,9 +53,10 @@ jobs:
runs-on: "ubuntu-latest"
needs:
- "build"

env:
GITHUB_TOKEN: "{{ '${{ secrets.GITHUB_TOKEN }}' }}"
environment:
name: "pypi"
permissions:
id-token: "write"

steps:
{{ checkout(depth=1, path=plugin_name) | indent(6) }}
Expand All @@ -78,25 +73,21 @@ jobs:
tar -xvf {{ plugin.app_label }}-python-client.tar
{%- endfor %}

{{ setup_python() | indent(6) }}

{{ install_python_deps(["twine"]) | indent(6) }}

{{ set_secrets() | indent(6) }}

- name: "Publish client to pypi"
run: |
bash .github/workflows/scripts/publish_client_pypi.sh {{ "${{ github.ref_name }}" }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: "{{ plugin_name }}/dist/"
{%- endif %}

{%- if deploy_client_to_rubygems %}
publish-ruby-bindings:
runs-on: "ubuntu-latest"
needs:
- "build"

env:
GITHUB_TOKEN: "{{ "${{ secrets.GITHUB_TOKEN }}" }}"
environment:
name: "rubygems"
permissions:
id-token: "write"

steps:
{{ checkout(depth=1, path=plugin_name) | indent(6) }}
Expand All @@ -115,11 +106,14 @@ jobs:

{{ setup_ruby() | indent(6) }}

{{ set_secrets() | indent(6) }}
- name: "Set RubyGems Credentials"
uses: "rubygems/configure-rubygems-credentials@v1.0.0"

- name: "Publish client to rubygems"
- name: "Publish client to RubyGems"
run: |
bash .github/workflows/scripts/publish_client_gem.sh {{ "${{ github.ref_name }}" }}
{%- for plugin in plugins %}
gem push "{{ plugin.name | snake }}_client-{{ "${{ github.ref_name }}" }}.gem"
{%- endfor %}
{%- endif %}
{%- endif %}

Expand Down