Update SDK #160
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: Update SDK | |
| on: | |
| schedule: | |
| - cron: 30 8 * * TUE | |
| workflow_dispatch: | |
| jobs: | |
| update-sdk: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: GitHubSecurityLab/actions-permissions/monitor@v1 | |
| with: | |
| config: ${{ vars.PERMISSIONS_CONFIG }} | |
| - name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - id: version | |
| run: echo "VERSION=$(curl -sSfL -X GET https://api.github.com/repos/mongodb/atlas-sdk-go/releases/latest | jq -r '.tag_name')" >> "$GITHUB_OUTPUT" | |
| - run: make update-atlas-sdk | |
| - name: Verify Changed files | |
| uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf | |
| id: verify-changed-files | |
| with: | |
| files: | | |
| ./internal/**/* | |
| go.mod | |
| go.sum | |
| - name: Find JIRA ticket | |
| id: find | |
| if: steps.verify-changed-files.outputs.files_changed == 'true' | |
| uses: mongodb/apix-action/find-jira@6c3fde402c21942fa46cde003f190c2b23c59530 | |
| with: | |
| token: ${{ secrets.JIRA_API_TOKEN }} | |
| jql: project = CLOUDP and summary ~ "Bump Atlas GO SDK to '${{ steps.version.outputs.VERSION }}'" | |
| - name: Set JIRA ticket (find) | |
| if: (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'true') | |
| run: | | |
| echo "JIRA_KEY=${{steps.find.outputs.issue-key}}" >> "$GITHUB_ENV" | |
| - name: Create JIRA ticket | |
| uses: mongodb/apix-action/create-jira@6c3fde402c21942fa46cde003f190c2b23c59530 | |
| id: create | |
| if: (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'false') | |
| with: | |
| token: ${{ secrets.JIRA_API_TOKEN }} | |
| project-key: CLOUDP | |
| summary: Bump Atlas GO SDK to '${{ steps.version.outputs.VERSION }}' | |
| issuetype: Story | |
| description: Update Atlas GO SDK to '${{ steps.version.outputs.VERSION }}' | |
| components: AtlasCLI | |
| assignee: ${{ secrets.ASSIGNEE_JIRA_TICKET }} | |
| extra-data: | | |
| { | |
| "fields": { | |
| "fixVersions": [ | |
| { | |
| "name": "next-atlascli-release" | |
| } | |
| ], | |
| "customfield_12751": [ | |
| { | |
| "id": "22223" | |
| } | |
| ], | |
| "customfield_10257": { | |
| "id": "11861" | |
| } | |
| } | |
| } | |
| - name: Set JIRA ticket (create) | |
| if: (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'false') | |
| run: | | |
| echo "JIRA_KEY=${{steps.create.outputs.issue-key}}" >> "$GITHUB_ENV" | |
| - name: set Apix Bot token | |
| if: steps.verify-changed-files.outputs.files_changed == 'true' | |
| id: app-token | |
| uses: mongodb/apix-action/token@6c3fde402c21942fa46cde003f190c2b23c59530 | |
| with: | |
| app-id: ${{ secrets.APIXBOT_APP_ID }} | |
| private-key: ${{ secrets.APIXBOT_APP_PEM }} | |
| - uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 | |
| id: pr | |
| if: steps.verify-changed-files.outputs.files_changed == 'true' | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| committer: "${{ steps.app-token.outputs.user-name }} <${{ steps.app-token.outputs.user-email }}>" | |
| author: "${{ steps.app-token.outputs.user-name }} <${{ steps.app-token.outputs.user-email }}>" | |
| title: "${{ env.JIRA_KEY }}: Bump Atlas GO SDK to ${{ steps.version.outputs.VERSION }}" | |
| commit-message: "${{ env.JIRA_KEY }}: Bump Atlas GO SDK to ${{ steps.version.outputs.VERSION }}" | |
| delete-branch: true | |
| base: master | |
| branch: ${{ env.JIRA_KEY }} | |
| labels: | | |
| dependencies | |
| go | |
| atlas-sdk | |
| auto_close_jira | |
| body: | | |
| ## Proposed changes | |
| Update MongoDB Atlas Go Client SDK to ${{ steps.version.outputs.VERSION }} | |
| _Jira ticket:_ ${{ env.JIRA_KEY }} | |
| Note: Jira ticket will be closed automatically when this PR is merged. | |
| - name: Checkout PR branch | |
| if: steps.verify-changed-files.outputs.files_changed == 'true' | |
| run: | | |
| git fetch origin ${{ env.JIRA_KEY }} | |
| git checkout ${{ env.JIRA_KEY }} | |
| - name: Generate and commit purls.txt | |
| if: steps.verify-changed-files.outputs.files_changed == 'true' | |
| run: | | |
| make gen-purls | |
| echo "Changes to purls.txt:" | |
| if git diff --exit-code build/package/purls.txt; then | |
| echo "No changes to purls.txt" | |
| else | |
| git config --global user.name "${{ steps.app-token.outputs.user-name }}" | |
| git config --global user.email "${{ steps.app-token.outputs.user-email }}" | |
| git add build/package/purls.txt | |
| git commit -m "chore: update purls.txt" | |
| git push origin ${{ env.JIRA_KEY }} | |
| fi | |
| - name: Set auto merge | |
| if: steps.verify-changed-files.outputs.files_changed == 'true' | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: | | |
| gh pr merge "${{ steps.pr.outputs.pull-request-url }}" --auto --squash |