Skip to content

Commit

Permalink
Fixes contious delivery (#945)
Browse files Browse the repository at this point in the history
* edited the env file

* fix CD

* added Codecov token

* fixes error

* remove docov token continuous-integration.yml

* removed codecov token continuous-delivery.yml

* Update _footer.html.erb

* Update continuous-delivery.yml

* Update continuous-delivery.yml

* edited auto switch env

* alternative format 1

* revert changes
  • Loading branch information
lodewiges authored Jan 19, 2025
1 parent 1d0faf7 commit 62b9058
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
target_env:
type: choice
description: Target environment
Expand Down Expand Up @@ -53,11 +59,11 @@ jobs:
- name: Get metadata
id: get_metadata
env:
INPUT_MERGE: ${{ github.event.inputs.merge }}
INPUT_MERGE: ${{ inputs.merge }}
TARGET_ENV: ${{ github.event.inputs.target_env }}
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"
Expand All @@ -79,7 +85,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:
Expand All @@ -101,7 +107,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
Expand All @@ -111,16 +117,16 @@ 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"
continuous_integration:
name: Continuous Integration
needs: [metadata, merge]
if: fromJSON(needs.metadata.outputs.has_diff)
uses: csvalpha/sofia/.github/workflows/continuous-integration.yml@staging
if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff
uses: csvalpha/sofia/.github/workflows/continuous-integration.yml@$staging
with:
sha: ${{ needs.merge.outputs.sha }}
secrets:
Expand All @@ -130,8 +136,8 @@ jobs:
publish_image:
name: Publish Image
needs: [metadata, merge]
if: fromJSON(needs.metadata.outputs.has_diff)
uses: csvalpha/sofia/.github/workflows/publish-image.yml@staging
if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff
uses: csvalpha/sofia/.github/workflows/publish-image.yml@$staging
with:
sha: ${{ needs.merge.outputs.sha }}
secrets:
Expand All @@ -143,8 +149,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
Expand Down

0 comments on commit 62b9058

Please sign in to comment.