From 48e72dbae9d3ae107d1c831fd461d82c55d6c970 Mon Sep 17 00:00:00 2001 From: Andreas Salhus Bakseter <141913422+baksetercx@users.noreply.github.com> Date: Mon, 19 Aug 2024 14:12:24 +0200 Subject: [PATCH] Fix comment & conditional job running --- .../workflows/example-build-deploy-dotnet-google.yml | 10 +++++----- .github/workflows/example-build-deploy-dotnet.yml | 10 +++++----- .github/workflows/example-build-deploy-go-google.yml | 10 +++++----- .github/workflows/example-build-deploy-go.yml | 10 +++++----- .github/workflows/update-starter-workflows.yml | 1 + 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/example-build-deploy-dotnet-google.yml b/.github/workflows/example-build-deploy-dotnet-google.yml index b5eb5a34..d32c3920 100644 --- a/.github/workflows/example-build-deploy-dotnet-google.yml +++ b/.github/workflows/example-build-deploy-dotnet-google.yml @@ -71,8 +71,8 @@ jobs: deploy-dev: name: Deploy Dev - # Required these jobs to be successful before running this job. - # Any of these can be commented out if you want to deploy anyway. + # Require all jobs below to be successful before running this job. + # Any of these can be commented out or removed if you want to deploy anyway. needs: - unit-tests - integration-tests @@ -83,7 +83,7 @@ jobs: contents: read id-token: write environment: dev - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk @@ -106,7 +106,7 @@ jobs: contents: read id-token: write environment: test - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk @@ -129,7 +129,7 @@ jobs: contents: read id-token: write environment: prod - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk diff --git a/.github/workflows/example-build-deploy-dotnet.yml b/.github/workflows/example-build-deploy-dotnet.yml index 3bc934b0..a47e5026 100644 --- a/.github/workflows/example-build-deploy-dotnet.yml +++ b/.github/workflows/example-build-deploy-dotnet.yml @@ -71,8 +71,8 @@ jobs: deploy-dev: name: Deploy Dev - # Required these jobs to be successful before running this job. - # Any of these can be commented out if you want to deploy anyway. + # Require all jobs below to be successful before running this job. + # Any of these can be commented out or removed if you want to deploy anyway. needs: - unit-tests - integration-tests @@ -83,7 +83,7 @@ jobs: contents: read id-token: write environment: dev - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk @@ -104,7 +104,7 @@ jobs: contents: read id-token: write environment: test - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk @@ -125,7 +125,7 @@ jobs: contents: read id-token: write environment: prod - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk diff --git a/.github/workflows/example-build-deploy-go-google.yml b/.github/workflows/example-build-deploy-go-google.yml index 5aa3d39d..9655567d 100644 --- a/.github/workflows/example-build-deploy-go-google.yml +++ b/.github/workflows/example-build-deploy-go-google.yml @@ -44,8 +44,8 @@ jobs: deploy-dev: name: Deploy Dev - # Required these jobs to be successful before running this job. - # Any of these can be commented out if you want to deploy anyway. + # Require all jobs below to be successful before running this job. + # Any of these can be commented out or removed if you want to deploy anyway. needs: - build-scan - analyze @@ -54,7 +54,7 @@ jobs: contents: read id-token: write environment: dev - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk @@ -77,7 +77,7 @@ jobs: contents: read id-token: write environment: test - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk @@ -100,7 +100,7 @@ jobs: contents: read id-token: write environment: prod - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk diff --git a/.github/workflows/example-build-deploy-go.yml b/.github/workflows/example-build-deploy-go.yml index a31b3adb..a47e754b 100644 --- a/.github/workflows/example-build-deploy-go.yml +++ b/.github/workflows/example-build-deploy-go.yml @@ -44,8 +44,8 @@ jobs: deploy-dev: name: Deploy Dev - # Required these jobs to be successful before running this job. - # Any of these can be commented out if you want to deploy anyway. + # Require all jobs below to be successful before running this job. + # Any of these can be commented out or removed if you want to deploy anyway. needs: - build-scan - analyze @@ -54,7 +54,7 @@ jobs: contents: read id-token: write environment: dev - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk @@ -75,7 +75,7 @@ jobs: contents: read id-token: write environment: test - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk @@ -96,7 +96,7 @@ jobs: contents: read id-token: write environment: prod - # Only on push to trunk + # Only on push to $default-branch if: github.ref == 'refs/heads/trunk' steps: - uses: 3lvia/core-github-actions-templates/deploy@trunk diff --git a/.github/workflows/update-starter-workflows.yml b/.github/workflows/update-starter-workflows.yml index 3e2dcc49..2764e6ee 100644 --- a/.github/workflows/update-starter-workflows.yml +++ b/.github/workflows/update-starter-workflows.yml @@ -65,6 +65,7 @@ jobs: sed -i "s/ SYSTEM_NAME: 'core'/ SYSTEM_NAME: ''/g" "$new_workflow_path" sed -i "s/ HELM_VALUES_PATH: '.*'/ HELM_VALUES_PATH: '.github\/deploy\/values.yml'/g" "$new_workflow_path" sed -i "s/ PROJECT_FILE: '.*'/ PROJECT_FILE: ''/g" "$new_workflow_path" + sed -i "s/refs\/heads\/trunk/$default-branch/g" "$new_workflow_path" sed -i "s/# pull_request:/ pull_request:/g" "$new_workflow_path" sed -i "s/# branches: \[trunk\]/ branches: \[trunk\]/g" "$new_workflow_path" sed -i 's/branches: \[trunk\]/branches: \[$default-branch\]/g' "$new_workflow_path"