|
| 1 | +name: Publish OAuth2Client Package |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + cab_id: |
| 6 | + description: "CAB id for the change/release" |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + |
| 13 | + runs-on: ubuntu-latest |
| 14 | + environment: prod |
| 15 | + |
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + pull-requests: write |
| 19 | + |
| 20 | + steps: |
| 21 | + |
| 22 | + - name: checkout dotnet repo |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + repository: XeroAPI/Xero-NetStandard |
| 26 | + path: Xero-NetStandard |
| 27 | + |
| 28 | + - name: Setup .NET |
| 29 | + uses: actions/setup-dotnet@v4 |
| 30 | + with: |
| 31 | + dotnet-version: 8.0.x |
| 32 | + |
| 33 | + - name: Restore dependencies |
| 34 | + run: dotnet restore |
| 35 | + working-directory: Xero-NetStandard |
| 36 | + |
| 37 | + - name: Build |
| 38 | + run: dotnet build --no-restore |
| 39 | + working-directory: Xero-NetStandard |
| 40 | + |
| 41 | + - name: Create OAuth2Client Package for Nuget.org |
| 42 | + run: dotnet pack ./Xero.NetStandard.OAuth2Client/Xero.NetStandard.OAuth2Client.csproj |
| 43 | + working-directory: Xero-NetStandard |
| 44 | + |
| 45 | + - name: Publish OAuth2Client Package to Nuget.org |
| 46 | + run: dotnet nuget push ./Xero.NetStandard.OAuth2Client/bin/Release/Xero.NetStandard.OAuth2Client.*.nupkg --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json |
| 47 | + working-directory: Xero-NetStandard |
| 48 | + |
| 49 | + notify-slack-on-success: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + needs: build |
| 52 | + if: success() |
| 53 | + permissions: |
| 54 | + contents: read |
| 55 | + steps: |
| 56 | + - name: Checkout Xero-NetStandard repo |
| 57 | + uses: actions/checkout@v4 |
| 58 | + with: |
| 59 | + repository: XeroAPI/Xero-NetStandard |
| 60 | + path: Xero-NetStandard |
| 61 | + |
| 62 | + - name: Send slack notification on success |
| 63 | + uses: ./Xero-NetStandard/.github/actions/notify-slack |
| 64 | + with: |
| 65 | + heading_text: "OAuth2Client Package publish job has succeeded !" |
| 66 | + alert_type: "thumbsup" |
| 67 | + job_status: "Success" |
| 68 | + XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} |
| 69 | + job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" |
| 70 | + button_type: "primary" |
| 71 | + package_version: "OAuth2Client" |
| 72 | + repo_link: ${{github.server_url}}/${{github.repository}} |
| 73 | + |
| 74 | + notify-slack-on-failure: |
| 75 | + runs-on: ubuntu-latest |
| 76 | + needs: build |
| 77 | + if: failure() |
| 78 | + permissions: |
| 79 | + contents: read |
| 80 | + steps: |
| 81 | + - name: Checkout Xero-NetStandard repo |
| 82 | + uses: actions/checkout@v4 |
| 83 | + with: |
| 84 | + repository: XeroAPI/Xero-NetStandard |
| 85 | + path: Xero-NetStandard |
| 86 | + |
| 87 | + - name: Send slack notification on failure |
| 88 | + uses: ./Xero-NetStandard/.github/actions/notify-slack |
| 89 | + with: |
| 90 | + heading_text: "OAuth2Client Package publish job has failed !" |
| 91 | + alert_type: "alert" |
| 92 | + job_status: "Failed" |
| 93 | + XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} |
| 94 | + job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" |
| 95 | + button_type: "danger" |
| 96 | + package_version: "OAuth2Client" |
| 97 | + repo_link: ${{github.server_url}}/${{github.repository}} |
0 commit comments