From a763300be1e7699c45964cf4cadac270eebc6c5a Mon Sep 17 00:00:00 2001 From: ZachiNachshon Date: Thu, 9 May 2024 21:01:31 +0300 Subject: [PATCH] internal(CI): Added a GitHub release action to create a new tag/release per plugin Removed the option to build publish/release all plugins at once --- .github/workflows/publish.yaml | 3 +- .github/workflows/release.yaml | 54 ++++++++++++++++++++++++ provisioner_examples_plugin/Makefile | 6 +-- provisioner_installers_plugin/Makefile | 7 +-- provisioner_single_board_plugin/Makefile | 7 +-- 5 files changed, 66 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 8d1131b..85c908d 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,7 +10,6 @@ on: - 'provisioner_examples_plugin' - 'provisioner_installers_plugin' - 'provisioner_single_board_plugin' - - 'all' required: true env: @@ -20,7 +19,7 @@ env: POETRY_VERSION: "1.4.1" jobs: - publis_to_pypi: + publish_to_pypi: name: Publish provisioner plugins to PyPi runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..64ea8ff --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,54 @@ +name: Create a GitHub plugin release + +on: + workflow_dispatch: + inputs: + plugin_to_publish: + type: choice + description: 'Select plugin to add as GitHub release' + options: + - 'provisioner_examples_plugin' + - 'provisioner_installers_plugin' + - 'provisioner_single_board_plugin' + required: true + +env: + PYPI_API_TOKEN: ${{ secrets.PROVISIONER_PYPI_API_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_ACTION_PLUGIN_TO_PUBLISH: ${{ github.event.inputs.plugin_to_publish }} + POETRY_VERSION: "1.4.1" + +jobs: + publish_to_pypi: + name: Publish provisioner plugins to PyPi + runs-on: ubuntu-latest + strategy: + matrix: + python: [ '3.10' ] + + steps: + - name: Checkout ZachiNachshon/provisioner + uses: actions/checkout@v3 + with: + repository: 'ZachiNachshon/provisioner' + token: ${{ secrets.PROVISIONER_REPO_ACCESS_TOKEN }} + + - name: Checkout ZachiNachshon/provisioner-plugins + uses: actions/checkout@v3 + with: + path: './plugins' + + - name: Setup Environment + uses: ./.github/actions/setup + env: + PYTHON_VERSION: ${{ matrix.python }} + POETRY_VERSION: ${{ env.POETRY_VERSION }} + + # Tests should be run when the PR created after publish to PyPi was merged + + - name: Create a GitHub release + uses: ./.github/actions/release + with: + publishable: ${{ github.event.inputs.plugin_to_publish }} + is_plugin: true + GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} diff --git a/provisioner_examples_plugin/Makefile b/provisioner_examples_plugin/Makefile index 5db6651..b3e4fdb 100755 --- a/provisioner_examples_plugin/Makefile +++ b/provisioner_examples_plugin/Makefile @@ -68,12 +68,12 @@ pip-uninstall: ## Uninstall a source distribution from local pip .PHONY: pip-publish-github pip-publish-github: ## Publish a pip package tarball as a GitHub release - @${POETRY_PIP_RELEASER} publish \ + @${POETRY_PIP_RELEASER} publish -y \ --multi-project \ - --build-type sdist \ + --build-type wheel \ --plugin \ --release-type github \ - --release-tag $(shell cat ../../provisioner/provisioner/resources/version.txt) -y + --release-tag-prefix examples_plugin .PHONY: pip-publish-pypi pip-publish-pypi: ## Publish a pip package tarball as a PyPi release diff --git a/provisioner_installers_plugin/Makefile b/provisioner_installers_plugin/Makefile index b4b2f65..e23595d 100755 --- a/provisioner_installers_plugin/Makefile +++ b/provisioner_installers_plugin/Makefile @@ -58,11 +58,12 @@ pip-uninstall: ## Uninstall a source distribution from local pip .PHONY: pip-publish-github pip-publish-github: ## Publish a pip package tarball as a GitHub release - @${POETRY_PIP_RELEASER} publish \ - --build-type sdist \ + @${POETRY_PIP_RELEASER} publish -y \ + --multi-project \ + --build-type wheel \ --plugin \ --release-type github \ - --release-tag $(shell cat ../../provisioner/provisioner/resources/version.txt) -y + --release-tag-prefix installers_plugin .PHONY: pip-publish-pypi pip-publish-pypi: ## Publish a pip package tarball as a PyPi release diff --git a/provisioner_single_board_plugin/Makefile b/provisioner_single_board_plugin/Makefile index 949d2ce..84eebbe 100755 --- a/provisioner_single_board_plugin/Makefile +++ b/provisioner_single_board_plugin/Makefile @@ -58,11 +58,12 @@ pip-uninstall: ## Uninstall a source distribution from local pip .PHONY: pip-publish-github pip-publish-github: ## Publish a pip package tarball as a GitHub release - @${POETRY_PIP_RELEASER} publish \ - --build-type sdist \ + @${POETRY_PIP_RELEASER} publish -y \ + --multi-project \ + --build-type wheel \ --plugin \ --release-type github \ - --release-tag $(shell cat ../../provisioner/provisioner/resources/version.txt) -y + --release-tag-prefix single_board_plugin .PHONY: pip-publish-pypi pip-publish-pypi: ## Publish a pip package tarball as a PyPi release