|
6 | 6 | jobs:
|
7 | 7 | publish:
|
8 | 8 | runs-on: ubuntu-latest
|
| 9 | + outputs: |
| 10 | + release_number: ${{steps.get_latest_release_number.outputs.release_tag}} |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: write |
9 | 14 | steps:
|
10 | 15 | - name: Checkout xero-python repo
|
11 | 16 | uses: actions/checkout@v4
|
|
27 | 32 | sudo pip install twine
|
28 | 33 | working-directory: xero-python
|
29 | 34 |
|
| 35 | + - name: Fetch Latest release number |
| 36 | + id: get_latest_release_number |
| 37 | + run: | |
| 38 | + latest_version=$(gh release view --json tagName --jq '.tagName') |
| 39 | + echo "Latest release version is - $latest_version" |
| 40 | + echo "::set-output name=release_tag::$latest_version" |
| 41 | + working-directory: xero-python |
| 42 | + env: |
| 43 | + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 44 | + |
30 | 45 | - name: Build Package
|
31 | 46 | run: python setup.py sdist
|
32 | 47 | working-directory: xero-python
|
|
37 | 52 | TWINE_PASSWORD: ${{ secrets.PYPI_APIKEY }}
|
38 | 53 | run: twine upload dist/*
|
39 | 54 | working-directory: xero-python
|
| 55 | + |
| 56 | + notify-slack-on-success: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: publish |
| 59 | + if: success() |
| 60 | + steps: |
| 61 | + - name: Checkout xero-pythonrepo |
| 62 | + uses: actions/checkout@v4 |
| 63 | + with: |
| 64 | + repository: XeroAPI/xero-python |
| 65 | + path: xero-python |
| 66 | + |
| 67 | + - name: Send slack notification on success |
| 68 | + uses: ./xero-python/.github/actions/notify-slack |
| 69 | + with: |
| 70 | + heading_text: "Publish job has succeeded !" |
| 71 | + alert_type: "thumbsup" |
| 72 | + job_status: "Success" |
| 73 | + XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} |
| 74 | + job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" |
| 75 | + button_type: "primary" |
| 76 | + package_version: ${{needs.publish.outputs.release_number}} |
| 77 | + repo_link: ${{github.server_url}}/${{github.repository}} |
| 78 | + |
| 79 | + notify-slack-on-failure: |
| 80 | + runs-on: ubuntu-latest |
| 81 | + needs: publish |
| 82 | + if: failure() |
| 83 | + steps: |
| 84 | + - name: Checkout xero-python repo |
| 85 | + uses: actions/checkout@v4 |
| 86 | + with: |
| 87 | + repository: XeroAPI/xero-python |
| 88 | + path: xero-python |
| 89 | + |
| 90 | + - name: Send slack notification on failure |
| 91 | + uses: ./xero-python/.github/actions/notify-slack |
| 92 | + with: |
| 93 | + heading_text: "Publish job has failed !" |
| 94 | + alert_type: "alert" |
| 95 | + job_status: "Failed" |
| 96 | + XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} |
| 97 | + job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" |
| 98 | + button_type: "danger" |
| 99 | + package_version: ${{needs.publish.outputs.release_number}} |
| 100 | + repo_link: ${{github.server_url}}/${{github.repository}} |
0 commit comments