-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Devide the release process in two parts
This will first run a workflow that performs the "git-actions", like creating the changelog, bumping the version and tagging. Secondly the tag itself will trigger a publish workflow that will build packages and docs and publish them to the corresponding places. [noissue]
- Loading branch information
Showing
9 changed files
with
309 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,269 @@ | ||
{% include 'header.j2' %} | ||
{% from 'macros.j2' import | ||
set_env_vars, | ||
checkout, | ||
setup_python, | ||
setup_ruby, | ||
install_httpie, | ||
display_logs, | ||
run_script, | ||
set_secrets, | ||
install_python_deps, | ||
configure_git, | ||
with context %} | ||
--- | ||
name: "{{ plugin_app_label | camel }} Publish Release" | ||
on: | ||
push: | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]" | ||
|
||
defaults: | ||
run: | ||
working-directory: "{{ plugin_name }}" | ||
|
||
jobs: | ||
build: | ||
uses: "./.github/workflows/build.yml" | ||
|
||
build-bindings-docs: | ||
needs: build-artifacts | ||
runs-on: ubuntu-latest | ||
# Install scripts expect TEST to be set, 'docs' is most appropriate even though we don't run tests | ||
env: | ||
TEST: docs | ||
PLUGIN_VERSION: {{ "${{ github.ref_name }}" }} | ||
|
||
steps: | ||
{{ checkout(depth=1, path=plugin_name) | indent(6) }} | ||
|
||
{{ checkout(repository="pulp/pulp-openapi-generator", path="pulp-openapi-generator") | indent(6) }} | ||
|
||
{{ setup_python() | indent(6) }} | ||
|
||
- uses: "actions/download-artifact@v3" | ||
with: | ||
name: "plugin_package" | ||
path: "{{ plugin_name }}/dist/" | ||
|
||
{%- if deploy_client_to_rubygems %} | ||
{{ setup_ruby() | indent(6) }} | ||
{%- endif %} | ||
|
||
{{ install_httpie() | indent(6) }} | ||
|
||
# Building the bindings and docs requires accessing the OpenAPI specs endpoint, so we need to | ||
# setup the Pulp instance. | ||
{{ run_script(name="Before Install", file="before_install.sh") | indent(6) }} | ||
|
||
{{ run_script(name="Install", file="install.sh") | indent(6) }} | ||
|
||
{{ run_script(name="Install Python client", file="install_python_client.sh", withenv=False) | indent(6) }} | ||
|
||
{%- if deploy_client_to_rubygems %} | ||
{{ run_script(name="Install Ruby client", file="install_ruby_client.sh", withenv=False) | indent(6) }} | ||
{%- endif %} | ||
|
||
{%- for plugin in plugins %} | ||
- name: "Upload python client packages" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "python-client.tar" | ||
path: "{{ plugin_name }}/{{ plugin.app_label }}-python-client.tar" | ||
if-no-files-found: "error" | ||
|
||
- name: "Upload python client docs" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "python-client-docs.tar" | ||
path: "{{ plugin_name }}/{{ plugin.app_label }}-python-client-docs.tar" | ||
if-no-files-found: "error" | ||
|
||
{%- if deploy_client_to_rubygems %} | ||
- name: "Upload ruby client packages" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "ruby-client.tar" | ||
path: "{{ plugin_name }}/{{ plugin.app_label }}-ruby-client.tar" | ||
if-no-files-found: "error" | ||
{%- endif %} | ||
{%- endfor %} | ||
|
||
{%- if publish_docs_to_pulpprojectdotorg and docs_test %} | ||
- name: Build docs | ||
run: | | ||
export DJANGO_SETTINGS_MODULE=pulpcore.app.settings | ||
export PULP_SETTINGS=$PWD/.ci/ansible/settings/settings.py | ||
make -C docs/ PULP_URL="{{ pulp_scheme }}://pulp" diagrams html | ||
tar -cvf docs/docs.tar docs/_build | ||
|
||
- name: "Upload built docs" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "docs.tar" | ||
path: "{{ plugin_name }}/docs/docs.tar" | ||
{%- endif %} | ||
|
||
{{ display_logs() | indent(6) }} | ||
|
||
{%- if deploy_to_pypi %} | ||
publish-package: | ||
runs-on: ubuntu-latest | ||
needs: build-bindings-docs | ||
|
||
env: | ||
GITHUB_TOKEN: {{ "${{ secrets.GITHUB_TOKEN }}" }} | ||
|
||
steps: | ||
{{ checkout(depth=1, path=plugin_name) | indent(6) }} | ||
|
||
- uses: "actions/download-artifact@v3" | ||
with: | ||
name: "plugin_package" | ||
path: "{{ plugin_name }}/dist/" | ||
|
||
{{ setup_python(pyversion="3.8") | indent(6) }} | ||
|
||
{{ install_python_deps("requests packaging~=21.3") | indent(6) }} | ||
|
||
{{ set_secrets() | indent(6) }} | ||
|
||
- name: Deploy plugin to pypi | ||
run: bash .github/workflows/scripts/publish_plugin_pypi.sh {{ "${{ github.ref_name }}" }} | ||
{%- endif %} | ||
|
||
{%- if deploy_client_to_pypi %} | ||
publish-python-bindings: | ||
runs-on: ubuntu-latest | ||
needs: build-bindings-docs | ||
|
||
env: | ||
GITHUB_TOKEN: {{ "${{ secrets.GITHUB_TOKEN }}" }} | ||
|
||
steps: | ||
{{ checkout(depth=1, path=plugin_name) | indent(6) }} | ||
|
||
- name: "Download Python client" | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: "python-client.tar" | ||
path: "{{ plugin_name }}/" | ||
|
||
- name: "Untar python client packages" | ||
run: | | ||
{%- for plugin in plugins %} | ||
tar -xvf {{ plugin.app_label }}-python-client.tar | ||
{%- endfor %} | ||
|
||
{{ setup_python(pyversion="3.8") | indent(6) }} | ||
|
||
{{ install_python_deps("requests packaging~=21.3") | indent(6) }} | ||
|
||
{{ set_secrets() | indent(6) }} | ||
|
||
- name: "Publish client to pypi" | ||
run: | | ||
bash .github/workflows/scripts/publish_client_pypi.sh | ||
{%- endif %} | ||
|
||
{%- if deploy_client_to_rubygems %} | ||
publish-ruby-bindings: | ||
runs-on: ubuntu-latest | ||
needs: build-bindings-docs | ||
|
||
env: | ||
GITHUB_TOKEN: {{ "${{ secrets.GITHUB_TOKEN }}" }} | ||
|
||
steps: | ||
{{ checkout(depth=1, path=plugin_name) | indent(6) }} | ||
|
||
- name: "Download Ruby client" | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: "ruby-client.tar" | ||
path: "{{ plugin_name }}/" | ||
|
||
- name: "Untar Ruby client packages" | ||
run: | | ||
{%- for plugin in plugins %} | ||
tar -xvf {{ plugin.app_label }}-ruby-client.tar | ||
{%- endfor %} | ||
|
||
{{ setup_python(pyversion="3.8") | indent(6) }} | ||
|
||
{{ setup_ruby() | indent(6) }} | ||
|
||
{{ set_secrets() | indent(6) }} | ||
|
||
- name: "Publish client to rubygems" | ||
run: | | ||
bash .github/workflows/scripts/publish_client_gem.sh | ||
{%- endif %} | ||
|
||
{%- if publish_docs_to_pulpprojectdotorg %} | ||
publish-docs: | ||
runs-on: ubuntu-latest | ||
needs: build-bindings-docs | ||
|
||
env: | ||
GITHUB_TOKEN: {{ "${{ secrets.GITHUB_TOKEN }}" }} | ||
|
||
steps: | ||
{{ checkout(depth=1, path=plugin_name) | indent(6) }} | ||
|
||
{{ setup_python(pyversion="3.8") | indent(6) }} | ||
|
||
{{ install_python_deps("requests packaging~=21.3") | indent(6) }} | ||
|
||
{{ set_secrets() | indent(6) }} | ||
|
||
- name: "Download built docs" | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: "docs.tar" | ||
path: "{{ plugin_name }}/" | ||
|
||
- name: "Download Python client docs" | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: "python-client-docs.tar" | ||
path: "{{ plugin_name }}/" | ||
|
||
- name: Publish docs to pulpproject.org | ||
run: | | ||
tar -xvf docs.tar | ||
.github/workflows/scripts/publish_docs.sh tag {{ "${{ github.ref_name }}" }} | ||
{%- endif %} | ||
|
||
create-gh-release: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-bindings-docs | ||
{%- if deploy_to_pypi %} | ||
- publish-package | ||
{%- endif %} | ||
{%- if deploy_client_to_pypi %} | ||
- publish-python-bindings | ||
{%- endif %} | ||
{%- if deploy_client_to_rubygems %} | ||
- publish-ruby-bindings | ||
{%- endif %} | ||
{%- if publish_docs_to_pulpprojectdotorg %} | ||
- publish-docs | ||
{%- endif %} | ||
|
||
steps: | ||
- name: Create release on GitHub | ||
uses: actions/github-script@v7 | ||
env: | ||
TAG_NAME: {{ '${{ github.ref_name }}' }} | ||
with: | ||
const { TAG_NAME } = process.env; | ||
|
||
script: | | ||
await github.rest.repos.createRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag_name: TAG_NAME, | ||
make_latest: "legacy", | ||
}); |
Oops, something went wrong.