Repository navigation
SLCORE-1785 Create a common release automation workflow for IDE Experience #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,219 @@ | ||
| name: IDE Experience Reusable Automated Release | ||
|
|
||
| env: | ||
| JIRA_PROJECT_KEY: ${{ inputs.jira-project-key }} | ||
| USE_JIRA_SANDBOX: ${{ inputs.is-test-run }} | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| jira-project-key: | ||
| description: "Jira project key" | ||
| required: true | ||
| type: string | ||
| project-name: | ||
| description: "Project name to describe it in REL ticket, like 'SonarLint Core'" | ||
| required: true | ||
| type: string | ||
| pm-email: | ||
| description: "Product manager email to assign the REL ticket after release is done" | ||
| required: true | ||
| type: string | ||
|
Krosovok marked this conversation as resolved.
Resolved
|
||
| short-description: | ||
| description: "A brief summary of what the release contains" | ||
| required: true | ||
| type: string | ||
|
Krosovok marked this conversation as resolved.
Resolved
|
||
| is-test-run: | ||
| description: "For testing: use Jira sandbox and create draft releases in GitHub" | ||
| required: false | ||
| type: boolean | ||
| default: true | ||
| branch: | ||
| description: "Branch from which to do the release" | ||
| required: true | ||
| type: string | ||
| default: "master" | ||
| documentation-status: | ||
| description: "Status of the documentation field for Jira Release" | ||
| required: false | ||
| type: string | ||
| default: 'N/A' | ||
| with-optional-checks: | ||
| description: "True if you want the workflow to fail on releasability optional checks, false to ignore optional checks" | ||
| required: false | ||
| type: boolean | ||
| default: true | ||
|
|
||
| outputs: | ||
| new-version: | ||
| description: "New version to release" | ||
| value: ${{ jobs.release-in-jira.outputs.new-version }} | ||
|
Krosovok marked this conversation as resolved.
Resolved
|
||
|
|
||
| jobs: | ||
| pre-release-checks: | ||
| name: Pre-release checks | ||
| runs-on: github-ubuntu-latest-s | ||
| permissions: | ||
| statuses: read | ||
| contents: write | ||
| pull-requests: write | ||
| id-token: write | ||
| steps: | ||
| - name: Check Releasability Status | ||
| uses: SonarSource/release-github-actions/check-releasability-status@v1 | ||
| with: | ||
| branch: ${{ inputs.branch }} | ||
| with-optional-checks: ${{ inputs.with-optional-checks }} | ||
|
|
||
| prepare-release: | ||
| name: Prepare release | ||
| runs-on: github-ubuntu-latest-s | ||
| needs: pre-release-checks | ||
| permissions: | ||
| statuses: read | ||
| contents: read | ||
| id-token: write | ||
| outputs: | ||
| release-version: ${{ steps.get-release-version.outputs.release-version }} | ||
| jira-version-name: ${{ steps.get-jira-version.outputs.jira-version-name }} | ||
| jira-release-url: ${{ steps.get-jira-release-notes.outputs.jira-release-url }} | ||
| due-date: ${{ steps.calculate-due-date.outputs.due-date }} | ||
| steps: | ||
| # Full version (with build number) | ||
| - name: Get Release Version | ||
| id: get-release-version | ||
| uses: SonarSource/release-github-actions/get-release-version@v1 | ||
| with: | ||
| branch: ${{ inputs.branch }} | ||
|
|
||
| # Short version | ||
| - name: Get Jira Version | ||
| id: get-jira-version | ||
| uses: SonarSource/release-github-actions/get-jira-version@v1 | ||
|
|
||
| # We need only link from here | ||
| - name: Get Jira Release Notes | ||
| id: get-jira-release-notes | ||
| uses: SonarSource/release-github-actions/get-jira-release-notes@v1 | ||
|
|
||
| # Due date value | ||
| - name: Calculate due date | ||
| id: calculate-due-date | ||
| run: | | ||
| DUE_DATE=$(date -d "+ 2 days" +"%Y-%m-%d") | ||
| echo "Setting due date to 2 days from now: $DUE_DATE" | ||
| echo "due-date=$DUE_DATE" >> $GITHUB_OUTPUT | ||
|
|
||
| create-release-ticket: | ||
| name: Create release ticket | ||
| runs-on: github-ubuntu-latest-s | ||
| needs: prepare-release | ||
| permissions: | ||
| statuses: read | ||
| contents: read | ||
| id-token: write | ||
| outputs: | ||
| release-ticket-key: ${{ steps.create-ticket.outputs.release-ticket-key }} | ||
| release-ticket-url: ${{ steps.create-ticket.outputs.release-ticket-url }} | ||
| steps: | ||
| - name: Create Jira Release Ticket | ||
| id: create-ticket | ||
| uses: SonarSource/release-github-actions/create-jira-release-ticket@v1 | ||
| with: | ||
| project-name: ${{ inputs.project-name }} | ||
| short-description: ${{ inputs.short-description }} | ||
| documentation-status: ${{ inputs.documentation-status }} | ||
| due-date: ${{ needs.prepare-release.outputs.due-date }} | ||
| jira-release-url: ${{ needs.prepare-release.outputs.jira-release-url }} | ||
| start-progress: true | ||
| version: ${{ needs.prepare-release.outputs.release-version }} | ||
|
|
||
| publish-github-release: | ||
| name: Publish github release | ||
| runs-on: github-ubuntu-latest-s | ||
| needs: [ prepare-release, create-release-ticket ] | ||
|
Krosovok marked this conversation as resolved.
Resolved
|
||
| permissions: | ||
| id-token: write | ||
| contents: write | ||
| actions: write | ||
| outputs: | ||
| github-release-url: ${{ steps.publish-github-release.outputs.release-url }} | ||
| steps: | ||
| - name: Publish GitHub Release | ||
| id: publish-github-release | ||
| uses: SonarSource/release-github-actions/publish-github-release@v1 | ||
| with: | ||
| release-version: ${{ needs.prepare-release.outputs.release-version }} | ||
| release-notes: ${{ format('For full release notes, see [JIRA]({0})', needs.prepare-release.outputs.jira-release-url) }} | ||
| draft: ${{ inputs.is-test-run }} | ||
| branch: ${{ inputs.branch }} | ||
|
|
||
| release-in-jira: | ||
| name: Release in Jira | ||
| runs-on: github-ubuntu-latest-s | ||
| needs: [ prepare-release, publish-github-release, create-release-ticket ] | ||
| permissions: | ||
| statuses: read | ||
| contents: read | ||
| id-token: write | ||
| outputs: | ||
| new-version: ${{ steps.create-jira-version.outputs.jira-new-version-name }} | ||
| steps: | ||
| - name: Release in Jira | ||
| uses: SonarSource/release-github-actions/release-jira-version@v1 | ||
| with: | ||
| jira-version-name: ${{ needs.prepare-release.outputs.jira-version-name }} | ||
|
|
||
| - name: Create new release in jira | ||
| id: create-jira-version | ||
| uses: SonarSource/release-github-actions/create-jira-version@v1 | ||
| with: | ||
| jira-version-name: ${{ needs.prepare-release.outputs.jira-version-name }} | ||
|
|
||
| - name: Move release ticket to Technical release Done | ||
| uses: SonarSource/release-github-actions/update-release-ticket-status@v1 | ||
| with: | ||
| release-ticket-key: ${{ needs.create-release-ticket.outputs.release-ticket-key }} | ||
| status: "Technical Release Done" | ||
| assignee: ${{ inputs.pm-email }} # TODO take it from vault | ||
|
|
||
| summarize_release: | ||
| name: Release | ||
| runs-on: github-ubuntu-latest-s | ||
| if: always() | ||
| needs: [ pre-release-checks, prepare-release, publish-github-release, create-release-ticket, release-in-jira ] | ||
| steps: | ||
| - name: Post Summary to Workflow | ||
| run: | | ||
| ALL_SUCCESS=$([[ "${{ needs.pre-release-checks.result }}" == "success" && \ | ||
| "${{ needs.prepare-release.result }}" == "success" && \ | ||
| "${{ needs.publish-github-release.result }}" == "success" && \ | ||
| "${{ needs.create-release-ticket.result }}" == "success" && \ | ||
| "${{ needs.release-in-jira.result }}" == "success" ]] && echo "true" || echo "false") | ||
|
|
||
| if [[ "$ALL_SUCCESS" == "true" ]]; then | ||
| echo "### 🎉🚀 Congratulations! Release Successful! 🚀🎉" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "**Summary of the release:**" >> $GITHUB_STEP_SUMMARY | ||
| else | ||
| echo "### ❌💥 Release Failed! 💥❌" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "**Summary of the failed release:**" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
|
|
||
| echo "- **Released Version:** ${{ needs.prepare-release.outputs.release-version }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **New Version:** ${{ needs.release-in-jira.outputs.new-version }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Jira Release URL:** ${{ needs.prepare-release.outputs.jira-release-url }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Release Ticket URL:** ${{ needs.create-release-ticket.outputs.release-ticket-url }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **GitHub Release URL:** ${{ needs.publish-github-release.outputs.github-release-url }}" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| if [[ "$ALL_SUCCESS" == "true" ]]; then | ||
|
Krosovok marked this conversation as resolved.
Resolved
|
||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
|
Krosovok marked this conversation as resolved.
Resolved
|
||
| echo "PS: Don't forget to review and merge the bump version!" >> $GITHUB_STEP_SUMMARY | ||
| echo "For more information please check the release instructions at:" >> $GITHUB_STEP_SUMMARY | ||
| echo "https://xtranet-sonarsource.atlassian.net/wiki/spaces/CodeRemedi/pages/3464134704/Release+processes" >> $GITHUB_STEP_SUMMARY | ||
| else | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
|
Krosovok marked this conversation as resolved.
Resolved
|
||
| echo "For fixes to common issues and other useful information please check the release instructions at:" >> $GITHUB_STEP_SUMMARY | ||
| echo "https://xtranet-sonarsource.atlassian.net/wiki/spaces/CodeRemedi/pages/3464134704/Release+processes" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.