Skip to content

Commit

Permalink
Merge pull request #32 from planningcenter/km/no-deploy
Browse files Browse the repository at this point in the history
feat: Allow for `--no-deploy` argument for test releases
  • Loading branch information
kylemellander authored Oct 24, 2024
2 parents 04c810d + 7e2af08 commit 5e780ef
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 102 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/qa-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ jobs:
steps:
- name: Push to protonova branch for Consumers
uses: planningcenter/pco-release-action/deploy@v1
if: ${{ !contains(github.event.comment.body, '--no-deploy') }}
with:
app-id: ${{ secrets.PCO_DEPENDENCIES_APP_ID }}
private-key: ${{ secrets.PCO_DEPENDENCIES_PRIVATE_KEY }}
Expand All @@ -114,9 +115,11 @@ jobs:
allow-major: true
package-json-path: ${{ inputs.package-json-path }}
- name: Post results to original PR
uses: planningcenter/pco-release-action/qa-reporting@v1
uses: planningcenter/pco-release-action/reporting@v1
with:
pr-number: ${{ github.event.issue.number }}
results-json: ${{ env.results_json }}
version-tag: ${{ needs.create-qa-release.outputs.release-tag }}
actor: ${{ github.actor }}
proto-tag: "${{ github.event.repository.name }}-${{ github.event.issue.number }}"
release-type: "QA"
5 changes: 4 additions & 1 deletion .github/workflows/release-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ jobs:
steps:
- name: Push to `staging` for Consumers
uses: planningcenter/pco-release-action/deploy@v1
if: ${{ !contains(github.event.comment.body, '--no-deploy') }}
with:
app-id: ${{ secrets.PCO_DEPENDENCIES_APP_ID }}
private-key: ${{ secrets.PCO_DEPENDENCIES_PRIVATE_KEY }}
Expand All @@ -114,8 +115,10 @@ jobs:
allow-major: true
package-json-path: ${{ inputs.package-json-path }}
- name: Post results to original PR
uses: planningcenter/pco-release-action/rc-reporting@v1
uses: planningcenter/pco-release-action/reporting@v1
with:
pr-number: ${{ github.event.issue.number }}
results-json: ${{ env.results_json }}
version-tag: ${{ needs.create-rc-release.outputs.release-tag }}
actor: ${{ github.actor }}
release-type: "RC"
2 changes: 1 addition & 1 deletion create-qa-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ runs:
run: |
touch release_notes.md
MODIFIED_COMMENT="${{ github.event.comment.body }}"
MODIFIED_COMMENT="${MODIFIED_COMMENT//@pco-release qa/}"
MODIFIED_COMMENT=$(echo "$MODIFIED_COMMENT" | sed -E 's/@pco-release[[:space:]]qa([[:space:]]--[^[:space:]]*)*[[:space:]]*//g')
echo "QA build for #${{ github.event.issue.number }}
$MODIFIED_COMMENT" > release_notes.md
Expand Down
2 changes: 1 addition & 1 deletion create-release-candidate/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ runs:
run: |
touch release_notes.md
MODIFIED_COMMENT="${{ github.event.comment.body }}"
MODIFIED_COMMENT="${MODIFIED_COMMENT//@pco-release rc/}"
MODIFIED_COMMENT=$(echo "$MODIFIED_COMMENT" | sed -E 's/@pco-release[[:space:]]rc([[:space:]]--[^[:space:]]*)*[[:space:]]*//g')
echo "$MODIFIED_COMMENT" > release_notes.md
- name: Create Release
uses: ncipollo/release-action@v1
Expand Down
52 changes: 0 additions & 52 deletions qa-reporting/action.yml

This file was deleted.

46 changes: 0 additions & 46 deletions rc-reporting/action.yml

This file was deleted.

77 changes: 77 additions & 0 deletions reporting/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Post results to original PR
inputs:
results-json:
description: "JSON string of results"
required: true
pr-number:
description: "The PR number that triggered the release"
required: true
actor:
description: "The actor that triggered the release"
required: true
version-tag:
description: "The tag of the version release"
required: true
release-type:
description: "The type of release"
required: true
proto-tag:
description: "The tag of the proto release (if it exists)"
required: false
runs:
using: "composite"
steps:
- uses: actions/github-script@v7
env:
PR_NUMBER: ${{ inputs.pr-number }}
RESULTS_JSON: ${{ inputs.results-json }}
ACTOR: ${{ inputs.actor }}
VERSION_TAG: ${{ inputs.version-tag }}
RELEASE_TYPE: ${{ inputs.release-type }}
with:
script: |
function getBody() {
if (!process.env.RESULTS_JSON) return ""
const results = JSON.parse(process.env.RESULTS_JSON);
const successfulRepoList = results.successful_repos.map(repo => `- \`${repo.name}\``).join("\n")
const failedRepoList = results.failed_repos.map(repo => `- \`${repo.name}\`: ${repo.message}`).join("\n")
return `
${process.env.PROTO_TAG ? "You can access the proto release at: https://${process.env.PROTO_TAG}.login.planningcenter.ninja/" : ""}
${results.successful_repos.length > 0 ? "### Deployed Successfully to the following repos:" : ""}
${successfulRepoList}
${results.failed_repos.length > 0 ? "### Failed to deploy in the following repos:" : ""}
${failedRepoList}
`
}
function getFailed() {
if (!process.env.RESULTS_JSON) return false
const results = JSON.parse(process.env.RESULTS_JSON);
return results.failed_repos.length > 0
}
function getHeader() {
return `## ${process.env.RELEASE_TYPE} release ${process.env.VERSION_TAG} successfully created`
}
const header = getHeader()
const body = getBody()
const footer = `Triggered by: @${process.env.ACTOR}`
github.rest.issues.createComment({
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${header}
${body}
${footer}`
});
if (getFailed()) {
throw new Error("Failed to push to all apps.");
}

0 comments on commit 5e780ef

Please sign in to comment.