chore: refactor workflows to align with the module template#136
Draft
Mrtenz wants to merge 1 commit into
Draft
Conversation
Add main.yml as the orchestrator (actionlint, security scan, build- lint-test, all-jobs aggregation, action-is-release, publish-release). Convert build-lint-test and publish-release to workflow_call.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
| if: inputs.slack-subteam != '' | ||
| run: | | ||
| DEFAULT_TEXT="\`${{ steps.name-hash.outputs.NAME_VERSION }}\` is awaiting deployment :rocket: \n <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/|→ Click here to review deployment>" | ||
| SUBTEAM_TEXT="${{ inputs.slack-subteam }}" |
Comment on lines
+23
to
+61
| announce-release: | ||
| name: Announce release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - id: name-hash | ||
| name: Get Slack name and hash | ||
| shell: bash | ||
| if: inputs.slack-subteam != '' | ||
| run: | | ||
| NAME_VERSION_TEXT=$(jq --raw-output '.name + "@" + .version' package.json ) | ||
| NAME_VERSION_TEXT_STRIPPED="${NAME_VERSION_TEXT#@}" | ||
| echo "NAME_VERSION=$NAME_VERSION_TEXT_STRIPPED" >> "$GITHUB_OUTPUT" | ||
| - id: final-text | ||
| name: Get Slack final text | ||
| shell: bash | ||
| if: inputs.slack-subteam != '' | ||
| run: | | ||
| DEFAULT_TEXT="\`${{ steps.name-hash.outputs.NAME_VERSION }}\` is awaiting deployment :rocket: \n <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/|→ Click here to review deployment>" | ||
| SUBTEAM_TEXT="${{ inputs.slack-subteam }}" | ||
| FINAL_TEXT="$DEFAULT_TEXT" | ||
| if [[ ! "$SUBTEAM_TEXT" == "" ]]; then | ||
| FINAL_TEXT="<!subteam^$SUBTEAM_TEXT> $DEFAULT_TEXT" | ||
| fi | ||
| echo "FINAL_TEXT=$FINAL_TEXT" >> "$GITHUB_OUTPUT" | ||
| - name: Post to a Slack channel | ||
| if: inputs.slack-subteam != '' | ||
| uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 | ||
| with: | ||
| payload: | | ||
| { | ||
| "text": "${{ steps.final-text.outputs.FINAL_TEXT }}", | ||
| "icon_url": "${{ inputs.slack-icon-url }}", | ||
| "username": "${{ inputs.slack-username }}" | ||
| } | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
| continue-on-error: true |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adopts the module template's workflow layout, with Action-specific deviations where this repo's nature requires them.
main.ymlorchestrator (new)Runs
actionlint(with the.github/actionlint-matcher.jsonmatcher), theMetaMask/action-security-code-scannerreusable workflow, thebuild-lint-testreusable workflow, and anall-jobs-passaggregator. On a push tomainauthored bygithub-actions,MetaMask/action-is-release@v2detects whether the commit is a release and, if so, calls thepublish-releasereusable workflow.build-lint-test.ymlConverted to
workflow_call. Gains a Node 20/22/24 matrix and a clean-working-directory check. The bespokeupdated-packages-testjob (runningscripts/get-release-packages.shagainstMetaMask/snaps@v120.0.0) is preserved verbatim, with acorepack enablestep added.publish-release.ymlConverted to
workflow_call. New flow:announce-release— posts a deployment-awaiting message to Slack.publish-release— checks out atgithub.sha, runs the action viauses: ./(we can't referenceMetaMask/action-publish-releasehere because this repo is that action), then updates the shorthand major version tag. The deploy gate uses theaction-publishenvironment.security-code-scanner.ymlretiredReplaced by the
analyse-codejob inmain.yml, which callsMetaMask/action-security-code-scanner/.github/workflows/security-scan.yml@v2(the module-template pattern).create-release-pr.ymlBumps to
MetaMask/action-create-release-pr@v5,actions/checkout@v6,actions/setup-node@v6withnode-version-file: '.nvmrc'. Should close the open Dependabot PR for the v5 bump.Script move
scripts/update-major-version-tag.sh→.github/workflows/scripts/update-major-version-tag.sh. It's only used by the publish workflow, so it lives next to it. Picks up the small polish fromaction-checkout-and-setup: quote the tag name in echo output, drop a trailing space.Part of an opportunistic module-template sync.