Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
daanpersoons committed Aug 25, 2024
1 parent 325c8f4 commit 0432c2b
Showing 1 changed file with 23 additions and 49 deletions.
72 changes: 23 additions & 49 deletions .github/workflows/workflow-build-and-deploy-scaleway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
type: string
required: true
monorepo-deployments:
description: List of deployments to roll out (folders), separated by commas
description: List of projects to roll out (folders), separated by commas
required: false
type: string
# Legacy parameters
Expand Down Expand Up @@ -60,83 +60,57 @@ on:
required: true

jobs:
monorepo-check:
name: Monorepo or not
generate-matrix:
name: Generate job matrices
runs-on: ubuntu-latest
outputs:
monorepo-check: ${{ steps.file_check.outputs.monorepo-check }}
deployments: ${{ steps.changed-paths-filter.outputs.matrix }}
deployments: ${{ steps.return-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: .github
- name: Check if file exists
id: file_check
run: |
if [ -f .github/monorepo-rollout-filters.yaml ];
then echo "monorepo-check=true" >> $GITHUB_OUTPUT;
else echo "monorepo-check=false" >> $GITHUB_OUTPUT; fi
- name: Generate Matrix
id: changed-paths-filter
if: ${{ steps.file_check.outputs.monorepo-check == 'true' }}
- name: Monorepo Matrix
id: monorepo-matrix
if: hashFiles('.github/monorepo-rollout-filters.yaml') != ''
uses: wisemen-digital/devops-ga-changed-paths-filter@main
with:
default-environment: ${{ github.repository }}
filter-file: .github/monorepo-rollout-filters.yaml
changes-override: ${{ inputs.monorepo-deployments}}

monorepo-build:
name: Build to ${{ matrix.deployment.path }}
needs: [monorepo-check]
if: ${{ needs.monorepo-check.outputs.monorepo-check == 'true' }}
- name: Return Matrix
id: return-matrix
run: |
if [ -f .github/monorepo-rollout-filters.yaml ];
then echo "matrix=$(echo '${{ steps.monorepo-matrix.outputs.matrix }}' | jq -c)" >> $GITHUB_OUTPUT;

Check warning on line 85 in .github/workflows/workflow-build-and-deploy-scaleway.yml

View workflow job for this annotation

GitHub Actions / Lint YAML

85:101 [line-length] line too long (109 > 100 characters)
else echo "matrix=$(echo '[{"environment":"wisemen-digital/${{ github.repository }}","path":"."}]' | jq -c)" >> $GITHUB_OUTPUT; fi

Check warning on line 86 in .github/workflows/workflow-build-and-deploy-scaleway.yml

View workflow job for this annotation

GitHub Actions / Lint YAML

86:101 [line-length] line too long (140 > 100 characters)
build-and-deploy:
name: Build to
needs: [generate-matrix]
if: ${{ needs.generate-matrix.outputs.deployments != '[]' }}
strategy:
matrix:
deployment: ${{ fromJson(needs.monorepo-check.outputs.deployments) }}
deployment: ${{ fromJson(needs.generate-matrix.outputs.deployments) }}
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: Extract name of the project
id: extract-name
- name: Extract name of the project to suffix
id: extract-suffix
shell: bash
run: |
full_path="${{ matrix.deployment.path }}"
echo "project-name="${full_path##*/}"" >> $GITHUB_OUTPUT
echo "project-name="-${full_path##*/}"" >> $GITHUB_OUTPUT
- name: Docker build & push
uses: wisemen-digital/devops-ga-docker-build-push@monorepo-required-changes
with:
image: ls-innoventa-${{ steps.extract-name.outputs.project-name }}
image: ${{ matrix.deployment.environment }}${{ steps.extract-suffix.outputs.project-name }}

Check warning on line 106 in .github/workflows/workflow-build-and-deploy-scaleway.yml

View workflow job for this annotation

GitHub Actions / Lint YAML

106:101 [line-length] line too long (102 > 100 characters)
container-registry: ${{ vars.CONTAINER_REGISTRY_ENDPOINT }}
container-registry-username: nologin
container-registry-password: ${{ secrets.SCALEWAY_SECRET_KEY }}
github-access-token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ inputs.environment }}
platforms: ${{ vars.CONTAINER_PLATFORMS }}
dockerfile-location: ${{ matrix.deployment.path }}

build:
name: Build to ${{ inputs.environment }}
needs: [monorepo-check]
if: ${{ needs.monorepo-check.outputs.monorepo-check == 'false' }}
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: Docker build & push
uses: wisemen-digital/devops-ga-docker-build-push@main
with:
container-registry: ${{ vars.CONTAINER_REGISTRY_ENDPOINT }}
container-registry-username: nologin
container-registry-password: ${{ secrets.SCALEWAY_SECRET_KEY }}
github-access-token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ inputs.environment }}
platforms: ${{ vars.CONTAINER_PLATFORMS }}

k8s-deploy:
name: Rollout on cluster
needs: [monorepo-build, build]
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
if: always() && contains(needs.*.result, 'success') && !contains(needs.*.result, 'failure')
steps:
- name: Rollout on cluster
uses: wisemen-digital/devops-ga-k8s-rollout@main
with:
Expand Down

0 comments on commit 0432c2b

Please sign in to comment.