From d0d57eddb39a05a8b3f984c8d1ae8b6cf8ce53ed Mon Sep 17 00:00:00 2001 From: Arthur Iperoyg Date: Sun, 26 Jun 2022 17:53:14 -0300 Subject: [PATCH] new ci/cd pipeline connecting package release to api deploy - attempt 2 --- .../{package-ci.yml => 1_0-package-ci.yml} | 2 +- ...-code-check.yml => 1_1-package-code-check.yml} | 2 +- .github/workflows/2_0-package-prerelease.yml | 15 +++++++++++++++ .github/workflows/2_0-package-release.yml | 15 +++++++++++++++ ...ublish.yml => 2_1-package-publish-on-pypi.yml} | 12 +++++++----- ...sh.yml => 2_2-package-publish-on-testpypi.yml} | 2 -- ...ckato-to-api-cd.yml => 3_0-package-to-api.yml} | 2 +- 7 files changed, 40 insertions(+), 10 deletions(-) rename .github/workflows/{package-ci.yml => 1_0-package-ci.yml} (96%) rename .github/workflows/{package-code-check.yml => 1_1-package-code-check.yml} (97%) create mode 100644 .github/workflows/2_0-package-prerelease.yml create mode 100644 .github/workflows/2_0-package-release.yml rename .github/workflows/{package-publish.yml => 2_1-package-publish-on-pypi.yml} (78%) rename .github/workflows/{package-test-publish.yml => 2_2-package-publish-on-testpypi.yml} (95%) rename .github/workflows/{packato-to-api-cd.yml => 3_0-package-to-api.yml} (90%) diff --git a/.github/workflows/package-ci.yml b/.github/workflows/1_0-package-ci.yml similarity index 96% rename from .github/workflows/package-ci.yml rename to .github/workflows/1_0-package-ci.yml index 78b4673..b36f9db 100644 --- a/.github/workflows/package-ci.yml +++ b/.github/workflows/1_0-package-ci.yml @@ -11,7 +11,7 @@ on: jobs: build: - uses: ./.github/workflows/package-code-check.yml + uses: ./.github/workflows/1_1-package-code-check.yml secrets: inherit release: diff --git a/.github/workflows/package-code-check.yml b/.github/workflows/1_1-package-code-check.yml similarity index 97% rename from .github/workflows/package-code-check.yml rename to .github/workflows/1_1-package-code-check.yml index 8454c11..3ca73b7 100644 --- a/.github/workflows/package-code-check.yml +++ b/.github/workflows/1_1-package-code-check.yml @@ -1,4 +1,4 @@ -name: Package Check +name: Package Code Check on: workflow_call: diff --git a/.github/workflows/2_0-package-prerelease.yml b/.github/workflows/2_0-package-prerelease.yml new file mode 100644 index 0000000..3546f08 --- /dev/null +++ b/.github/workflows/2_0-package-prerelease.yml @@ -0,0 +1,15 @@ +# Publish Python Package to Pypi + +name: PreRelease on PyPi + +on: + release: + types: [prereleased] + +jobs: + + publish: + uses: ./.github/workflows/2_1-package-publish-on-pypi.yml + with: + tag_name: ${{ github.event.release.tag_name }} + secrets: inherit diff --git a/.github/workflows/2_0-package-release.yml b/.github/workflows/2_0-package-release.yml new file mode 100644 index 0000000..bfb3840 --- /dev/null +++ b/.github/workflows/2_0-package-release.yml @@ -0,0 +1,15 @@ +# Publish Python Package to Pypi + +name: Package Release + +on: + release: + types: [released] + +jobs: + + publish: + uses: ./.github/workflows/2_1-package-publish-on-pypi.yml + with: + tag_name: ${{ github.event.release.tag_name }} + secrets: inherit diff --git a/.github/workflows/package-publish.yml b/.github/workflows/2_1-package-publish-on-pypi.yml similarity index 78% rename from .github/workflows/package-publish.yml rename to .github/workflows/2_1-package-publish-on-pypi.yml index a2f4f07..e2f8a01 100644 --- a/.github/workflows/package-publish.yml +++ b/.github/workflows/2_1-package-publish-on-pypi.yml @@ -3,26 +3,28 @@ name: Publish on PyPi on: - release: - types: [published] + workflow_call: + inputs: + tag_name: + required: true + type: string jobs: publish: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 - name: Check release run: | - echo ${{ github.event.release.tag_name }} + echo ${{ inputs.tag_name }} - name: Fetch Github Release Asset uses: dsaltares/fetch-gh-release-asset@1.0.0 with: regex: true file: "complexoperations.*" target: "dist/" - version: tags/${{ github.event.release.tag_name }} + version: tags/${{ inputs.tag_name }} token: ${{ secrets.MY_TOKEN }} - name: Publish to PyPi uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/package-test-publish.yml b/.github/workflows/2_2-package-publish-on-testpypi.yml similarity index 95% rename from .github/workflows/package-test-publish.yml rename to .github/workflows/2_2-package-publish-on-testpypi.yml index 430a146..9f3f9f8 100644 --- a/.github/workflows/package-test-publish.yml +++ b/.github/workflows/2_2-package-publish-on-testpypi.yml @@ -1,5 +1,3 @@ -# Publish Python Package to Test Pypi - name: Publish on TestPypi on: workflow_dispatch diff --git a/.github/workflows/packato-to-api-cd.yml b/.github/workflows/3_0-package-to-api.yml similarity index 90% rename from .github/workflows/packato-to-api-cd.yml rename to .github/workflows/3_0-package-to-api.yml index fc16477..8bd2237 100644 --- a/.github/workflows/packato-to-api-cd.yml +++ b/.github/workflows/3_0-package-to-api.yml @@ -2,7 +2,7 @@ name: Package to API CD on: workflow_run: - workflows: [Publish on PyPi] + workflows: [Package Release] types: [completed] jobs: