diff --git a/.github/workflows/build.yaml b/.github/workflows/build-and-publish.yaml similarity index 67% rename from .github/workflows/build.yaml rename to .github/workflows/build-and-publish.yaml index 6d680d6..683ef70 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build-and-publish.yaml @@ -1,9 +1,6 @@ --- name: Build Package -env: - GIT_SSH_KEY: ${{ secrets.GIT_SSH_KEY }} - on: workflow_dispatch: push: @@ -18,20 +15,6 @@ jobs: with: fetch-depth: 0 -# - name: Setup SSH Agent -# uses: webfactory/ssh-agent@v0.5.3 -# with: -# ssh-private-key: ${{ secrets.GIT_SSH_KEY }} -# -# - name: Clone Required Repos -# run: git clone git@github.com:TetraVeda/kaslcred.git - - - name: Resolve Version - run: | - IMAGE_VERSION=$(git describe --tags --abbrev=0) - echo "IMAGE_VERSION=$IMAGE_VERSION" >> $GITHUB_ENV - echo "building version $IMAGE_VERSION" - - name: Setup Python uses: actions/setup-python@v4 with: @@ -65,4 +48,27 @@ jobs: uses: actions/upload-artifact@v3 with: name: python-package - path: dist/* \ No newline at end of file + path: dist/* + + publish: + runs-on: ubuntu-latest + environment: + name: publish-approval + steps: + - name: Download pacakge artifacts + uses: actions/download-artifact@v3 + with: + name: python-package + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install twine + run: | + python -m pip install --upgrade pip + python -m pip install twine + + - name: Publish + run: pipenv run twine upload dist/* \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index aef18ec..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: Publish Package - -env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/ - -on: - workflow_run: - workflows: ["Build Package"] - branches: ["main"] - types: - - completed - workflow_dispatch: - -jobs: - publish: - runs-on: ubuntu-latest - environment: - name: publish-approval - steps: - - name: Download pacakge artifacts - uses: actions/download-artifact@v3 - with: - name: python-package - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Install twine - run: | - python -m pip install --upgrade pip - python -m pip install twine - - - name: Publish - run: pipenv run twine upload dist/* \ No newline at end of file