diff --git a/.github/workflows/publish-reusable.yml b/.github/workflows/publish-reusable.yml index 98ae9e7..a7dab9a 100644 --- a/.github/workflows/publish-reusable.yml +++ b/.github/workflows/publish-reusable.yml @@ -3,10 +3,6 @@ name: Publish (reusable workflow) on: workflow_call: inputs: - version: - description: 'Version number or tag for the release. For example: v1.0.1' - required: true - type: string release_notes: description: 'Release notes' required: true @@ -16,7 +12,11 @@ on: required: true type: string environment_name: - description: 'Name of environment that specifies PyPI/TestPyPI url' + description: 'Name for PyPI/TestPyPI environment' + type: string + required: true + environment_url: + description: 'URL for PyPI/TestPyPI environment' type: string required: true secrets: @@ -31,10 +31,13 @@ jobs: publish: name: Build runs-on: ubuntu-latest - environment: ${{ inputs.environment_name }} + environment: + name: ${{ inputs.environment_name }} + url: ${{ inputs.environment_url }} env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} GITHUB_REPO: ${{ github.repository }} + GITHUB_REFNAME: ${{ github.ref_name }} steps: - name: Checkout repository @@ -73,11 +76,8 @@ jobs: - name: Create GitHub Release env: - VERSION: ${{ inputs.version }} NOTES: ${{ inputs.release_notes }} - run: gh release create $VERSION --repo $GITHUB_REPO --notes $NOTES + run: gh release create $GITHUB_REFNAME --repo $GITHUB_REPO --notes $NOTES - name: Upload GitHub Release - env: - VERSION: ${{ inputs.version }} - run: gh release upload $VERSION dist/** --repo $GITHUB_REPO + run: gh release upload $GITHUB_REFNAME dist/** --repo $GITHUB_REPO diff --git a/.github/workflows/publish-to-testpypi.yaml b/.github/workflows/publish-to-testpypi.yaml index c6a0c1d..23dca29 100644 --- a/.github/workflows/publish-to-testpypi.yaml +++ b/.github/workflows/publish-to-testpypi.yaml @@ -1,27 +1,18 @@ name: Publish to TestPyPI -on: - workflow_dispatch: - inputs: - version: - description: 'Version name for release' - required: true +on: push jobs: publish: name: Publish wheel to TestPyPI - runs-on: ubuntu-latest - environment: - name: testpypi - url: https://test.pypi.org/p/seclab-taskflow-agent2 permissions: contents: write id-token: write # For trusted publishing - uses: .github/workflows/publish-reusable.yml@main + uses: ./.github/workflows/publish-reusable.yml with: - version: ${{ inputs.version }} release_notes: ${{ github.head_ref }} repository_url: https://test.pypi.org/legacy/ - environment: testpypi + environment_name: testpypi + environment_url: https://test.pypi.org/p/seclab-taskflow-agent2 secrets: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}