0.3.0 #25
Workflow file for this run
This file contains hidden or 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
| name: "Release" | |
| on: | |
| release: | |
| types: [published] | |
| env: | |
| url: "https://${{ github.event.release.prerelease && 'test.' || '' }}pypi.org/p/actions-tools" | |
| repository-url: "https://${{ github.event.release.prerelease && 'test' || 'upload' }}.pypi.org/legacy/" | |
| jobs: | |
| build: | |
| name: "Build" | |
| uses: ./.github/workflows/build.yaml | |
| secrets: inherit | |
| with: | |
| name: "release" | |
| publish: | |
| name: "Publish" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| needs: [build] | |
| permissions: | |
| contents: write | |
| id-token: write | |
| environment: | |
| name: ${{ github.event.release.prerelease && 'test' || 'pypi' }} | |
| url: ${{ env.url }} | |
| steps: | |
| - name: "Debug" | |
| run: | | |
| echo "github.ref_name: ${{ github.ref_name }}" | |
| echo "name: ${{ github.event.release.prerelease && 'test' || 'pypi' }}" | |
| echo "env.url: ${{ env.url }}" | |
| echo "env.repository-url: ${{ env.repository-url }}" | |
| - name: "Debug CTX github" | |
| if: ${{ !github.event.act }} | |
| continue-on-error: true | |
| env: | |
| GITHUB_CTX: ${{ toJSON(github) }} | |
| run: echo "$GITHUB_CTX" | |
| - name: "Download Artifact" | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: "release" | |
| path: "dist" | |
| - name: "Verify Artifacts" | |
| env: | |
| path: "dist" | |
| tag: ${{ github.ref_name }} | |
| run: | | |
| ls -lAh ${path}/* | |
| results="$(ls -lAh ${path}/* | awk '{print $9" - "$5}')" | |
| markdown='Artifacts:\n```text\n'"${results}"'\n```' | |
| echo -e "${markdown}" >> $GITHUB_STEP_SUMMARY | |
| ls ${path} | grep -- "-${tag}-" > /dev/null | |
| - name: "Publish to PyPI" | |
| id: publish | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| verbose: true | |
| repository-url: ${{ env.repository-url }} | |
| #attestations: false | |
| - name: "Summary" | |
| if: ${{ always() }} | |
| env: | |
| tag: ${{ github.ref_name }} | |
| url: ${{ env.url }} | |
| repository-url: ${{ env.repository-url }} | |
| run: | | |
| if [ "${{ steps.publish.outcome }}" == "success" ];then | |
| markdown="🎉 Published Version: \`${tag}\`\n\n[${url}](${url})\n\n" | |
| else | |
| markdown="⛔ Error Publishing Version: \`${tag}\`\n\n" | |
| fi | |
| markdown+="Repository URL: \`${repository-url}\`" | |
| echo -e "${markdown}" >> $GITHUB_STEP_SUMMARY | |
| - name: "Send Notification" | |
| if: ${{ !cancelled() }} | |
| uses: sarisia/actions-status-discord@v1 | |
| with: | |
| webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
| description: | | |
| ${{ env.url }} | |
| ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} | |
| release: | |
| name: "Release" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| needs: [publish] | |
| steps: | |
| - name: "Debug" | |
| continue-on-error: true | |
| run: | | |
| echo "github.ref_name: ${{ github.ref_name }}" | |
| echo "github.event.release.prerelease: ${{ github.event.release.prerelease }}" | |
| - name: "Debug event.json" | |
| continue-on-error: true | |
| run: cat "${GITHUB_EVENT_PATH}" | |
| - name: "Debug CTX github" | |
| continue-on-error: true | |
| env: | |
| GITHUB_CTX: ${{ toJSON(github) }} | |
| run: echo "$GITHUB_CTX" | |
| #- name: "Debug Environment" | |
| # continue-on-error: true | |
| # run: env | |
| #- name: "Update Latest Tag" | |
| # if: ${{ !github.event.release.prerelease }} | |
| # uses: cssnr/update-version-tags-action@latest | |
| # continue-on-error: true | |
| # with: | |
| # major: false | |
| # minor: false | |
| # tags: latest | |
| # #tag: ${{ github.ref_name }} | |
| - name: "Download Artifact" | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: "release" | |
| path: dist | |
| - name: "List Artifacts" | |
| run: | | |
| ls -lAh dist | |
| ls dist | grep -- "-${{ github.ref_name }}-" > /dev/null | |
| - name: "Upload Release" | |
| uses: cssnr/upload-release-action@latest | |
| with: | |
| globs: dist/* | |
| - name: "Update Release Notes Action" | |
| continue-on-error: true | |
| uses: smashedr/update-release-notes-action@master | |
| with: | |
| location: tail | |
| - name: "Send Failure Notification" | |
| if: ${{ failure() }} | |
| uses: sarisia/actions-status-discord@v1 | |
| with: | |
| webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
| description: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} |