Be able to add/remove resources to/from a process application #944
This file contains 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: RELEASE_ISSUE | |
on: | |
issues: | |
types: [closed, assigned] | |
jobs: | |
create_release_issue: | |
runs-on: ubuntu-latest | |
name: Create new Release Issue | |
if: | | |
contains(github.event.issue.labels.*.name, 'release') && | |
github.event.action == 'closed' | |
outputs: | |
assignee: ${{ steps.create_release_issue.outputs.assignee }} | |
steps: | |
- id: create_release_issue | |
name: Create new Release Issue | |
uses: bpmn-io/actions/release-issue@latest | |
with: | |
template-path: 'docs/.project/RELEASE_TEMPLATE.md' | |
package-path: 'app/package.json' | |
assign_milestone: | |
name: Assign milestone | |
needs: create_release_issue | |
if: github.event.issue.milestone | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get current Milestone | |
id: getMilestone | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
# Fetch the list of milestones for the repository | |
# Filter for milestones that start with 'M' and are open | |
MILESTONE=$(gh api -H "Accept: application/vnd.github.v3+json" \ | |
/repos/${{ github.repository }}/milestones \ | |
--jq '.[] | select(.title | startswith("M")) | .number' | |
) | |
echo "MILESTONE_NUMBER=$MILESTONE" >> $GITHUB_OUTPUT | |
- name: Assign Milestone to new Issue | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh api \ | |
--method PATCH \ | |
-H "Accept: application/vnd.github+json" \ | |
/repos/${{ github.repository }}/issues/${{ fromJson(needs.create_release_issue.outputs.issue).number }} \ | |
-F "milestone=${{steps.getMilestone.outputs.MILESTONE_NUMBER}}" | |
update_slack_role: | |
name: Sync Slack roles | |
needs: create_release_issue | |
runs-on: ubuntu-latest | |
if: | | |
always() && | |
contains(github.event.issue.labels.*.name, 'release') | |
steps: | |
- name: Import Secrets | |
id: secrets | |
uses: hashicorp/vault-action@v3.0.0 | |
with: | |
url: ${{ secrets.VAULT_ADDR }} | |
method: approle | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
exportEnv: false | |
secrets: | | |
secret/data/products/desktop-modeler/ci/slack_integration RELEASE_MANAGER_GROUP_ID; | |
secret/data/products/desktop-modeler/ci/slack_integration SLACK_BOT_TOKEN; | |
secret/data/products/desktop-modeler/ci/slack_integration TEAM_MEMBER_IDS; | |
- name: Update slack | |
env: | |
SLACK_BOT_TOKEN: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }} | |
GROUP_ID: ${{ steps.secrets.outputs.RELEASE_MANAGER_GROUP_ID }} | |
# User ID is either the assignee from the newly created issue or the new assigned from the `assigned` trigger | |
USER_ID: ${{ fromJSON(steps.secrets.outputs.TEAM_MEMBER_IDS)[ needs.create_release_issue.outputs.assignee || github.event.issue.assignee.login ] }} | |
run: | | |
curl --fail-with-body -X POST -H "application/x-www-form-urlencoded" -d "token=${SLACK_BOT_TOKEN}&usergroup=${GROUP_ID}&users=${USER_ID}" https://slack.com/api/usergroups.users.update | |
notify_on_slack: | |
name: Notify new release manager on Slack | |
needs: create_release_issue | |
if: | | |
always() && | |
contains(github.event.issue.labels.*.name, 'release') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Import Secrets | |
id: secrets | |
uses: hashicorp/vault-action@v3.0.0 | |
with: | |
url: ${{ secrets.VAULT_ADDR }} | |
method: approle | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
exportEnv: false | |
secrets: | | |
secret/data/products/desktop-modeler/ci/slack_integration SLACK_CHANNEL_ID; | |
secret/data/products/desktop-modeler/ci/slack_integration SLACK_BOT_TOKEN; | |
- name: Post to a Slack channel | |
uses: slackapi/slack-github-action@v1 | |
with: | |
channel-id: ${{ steps.secrets.outputs.SLACK_CHANNEL_ID }} | |
slack-message: "Assigned <https://github.com/$RELEASE_MANAGER|@$RELEASE_MANAGER> as the release manager. Go to <$ISSUE_LINK|the release issue> to update if necessary." | |
env: | |
SLACK_BOT_TOKEN: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }} | |
# Release manager is either the assignee from the newly created issue or the new assigned from the `assigned` trigger | |
RELEASE_MANAGER: ${{ needs.create_release_issue.outputs.assignee || github.event.issue.assignee.login }} | |
ISSUE_LINK: https://github.com/${{ github.repository }}/issues/${{ fromJson(needs.create_release_issue.outputs.issue).number }} |