diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index aa58d4c6a..36a1b18f2 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -4,9 +4,15 @@ on: workflow_dispatch: inputs: merge: - description: Merge staging into master first? (y/N) + type: boolean + description: Merge staging into master first? required: false - default: 'n' + default: false + ignore_metadata_diff: + type: boolean + description: Perform all jobs, regardless of whether there are actual changes? + required: false + default: false concurrency: group: cd-${{ github.ref_name }} @@ -40,10 +46,10 @@ jobs: - name: Get metadata id: get_metadata env: - INPUT_MERGE: ${{ github.event.inputs.merge }} + INPUT_MERGE: ${{ inputs.merge }} run: | if [ "$GITHUB_REF_NAME" = 'master' ]; then - if [ "${INPUT_MERGE,,}" = 'y' ]; then + if [ "$INPUT_MERGE" == 'true' ]; then git fetch origin staging if ! git diff origin/master origin/staging --exit-code; then echo 'has_diff=true' >> "$GITHUB_OUTPUT" @@ -61,7 +67,7 @@ jobs: name: Merge runs-on: ubuntu-latest needs: metadata - if: github.event.inputs.merge == 'y' + if: inputs.merge outputs: sha: ${{ steps.get_sha.outputs.sha }} steps: @@ -83,7 +89,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Run merge - if: fromJSON(needs.metadata.outputs.has_diff) + if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f # tag=v1.4.0 with: type: now @@ -93,7 +99,7 @@ jobs: - name: Get merge commit SHA id: get_sha - if: fromJSON(needs.metadata.outputs.has_diff) + if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff run: | git fetch origin master echo 'sha='"$(git rev-parse origin/master)" >> "$GITHUB_OUTPUT" @@ -101,7 +107,7 @@ jobs: continuous_integration: name: Continuous Integration needs: [metadata, merge] - if: fromJSON(needs.metadata.outputs.has_diff) + if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff uses: csvalpha/amber-ui/.github/workflows/continuous-integration.yml@staging with: sha: ${{ needs.merge.outputs.sha }} @@ -111,7 +117,7 @@ jobs: publish_image: name: Publish Image needs: [metadata, merge] - if: fromJSON(needs.metadata.outputs.has_diff) + if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff uses: csvalpha/amber-ui/.github/workflows/publish-image.yml@staging with: sha: ${{ needs.merge.outputs.sha }} @@ -124,8 +130,8 @@ jobs: needs: [metadata, merge, continuous_integration, publish_image] if: | (github.ref_name == 'staging' || github.ref_name == 'master') && ((github.ref_name == 'master' && - github.event.inputs.merge == 'y' && fromJSON(needs.metadata.outputs.has_diff) && success()) || - ((github.event.inputs.merge != 'y' || !fromJSON(needs.metadata.outputs.has_diff)) && !cancelled())) + inputs.merge && (fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff) && success()) || + ((!inputs.merge || !(fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff)) && !cancelled())) steps: - name: Get environment URL id: get_url diff --git a/README.md b/README.md index 4a3c9b7cc..a2300eb69 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ Deployments are done using GitHub Actions. To deploy a branch, follow the follow - Choose a branch and if you want to merge the changes on the staging branch into the master branch (only possible when the branch chosen in previous step is master). - Click the green button "Run workflow". +*Note: If the workflow fails with an error message about blobs along the lines of the following: `buildx failed with: ERROR: failed to solve: [...] blob [...]`: remove all recent cache files for staging on the [Caches page](https://github.com/csvalpha/amber-ui/actions/caches) and try again. You might have to turn on the option `Perform all jobs, regardless of whether there are actual changes?` to force the workflow to re-execute all its jobs.* + ## Further Reading / Useful Links - [ember.js](https://emberjs.com/)