Last active
May 5, 2023 17:12
-
-
Save MPTG94/2592fa43acd816eef06c37b0db907166 to your computer and use it in GitHub Desktop.
Modified GitHub workflow SDLC template
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: Report SDLC to Port | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| jobs: | |
| report-to-port: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| persist-credentials: true | |
| fetch-depth: 2 | |
| - name: Extract SHA short | |
| if: ${{ always() }} | |
| id: get-short-sha | |
| run: | | |
| echo "SHA_SHORT=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT | |
| - name: "Readme content" | |
| id: readme | |
| run: | | |
| echo "readme=$(awk '{printf("%s\n", $0)}' README.md | tr '\n' '|' | sed 's/|/\\n/g')" >> "$GITHUB_OUTPUT" | |
| - name: "Report service to port" | |
| if: ${{ always() }} | |
| uses: port-labs/port-github-action@v1 | |
| with: | |
| clientId: ${{ secrets.PORT_CLIENT_ID }} | |
| clientSecret: ${{ secrets.PORT_CLIENT_SECRET }} | |
| identifier: ${{ github.event.repository.name }} | |
| title: ${{ github.event.repository.name }} | |
| blueprint: service | |
| properties: | | |
| { | |
| "name": "${{ github.event.repository.name }}", | |
| "url": "${{ github.server_url }}/${{ github.repository }}", | |
| "README": "${{ steps.readme.outputs.readme }}", | |
| "about": "${{ github.event.repository.description }}" | |
| } | |
| - name: "Report deployment to Port 🚢" | |
| if: ${{ always() }} | |
| uses: port-labs/port-github-action@v1 | |
| with: | |
| clientId: ${{ secrets.PORT_CLIENT_ID }} | |
| clientSecret: ${{ secrets.PORT_CLIENT_SECRET }} | |
| identifier: ${{ steps.get-short-sha.outputs.SHA_SHORT }} | |
| title: ${{ steps.get-short-sha.outputs.SHA_SHORT }} | |
| blueprint: deployment | |
| properties: | | |
| { | |
| "triggeringActor": "${{ github.actor }}", | |
| "link": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
| "commitSha": "${{ github.sha }}", | |
| "status": "success", | |
| "deployBranchUrl": "${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}", | |
| "deployBranch": "${{ github.ref_name }}" | |
| } | |
| relations: | | |
| { | |
| "service": "${{ github.event.repository.name }}" | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment