From 7b5da962fc4cf3791d8d8b9806442ca8f0a438f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=BCdi=20Tam=C3=A1s?= Date: Thu, 26 Sep 2024 20:45:56 +0200 Subject: [PATCH] small fixes --- .github/workflows/self-dev.yml | 10 +++++----- .github/workflows/self-prod.yml | 30 ++++++++++++++++++++++-------- scripts/build-docker-actions.sh | 4 ++-- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.github/workflows/self-dev.yml b/.github/workflows/self-dev.yml index 9ed19cb..e2d8ab1 100644 --- a/.github/workflows/self-dev.yml +++ b/.github/workflows/self-dev.yml @@ -1,18 +1,18 @@ -name: Developer workflow +name: CI on: pull_request: push: branches: - main - workflow_call: + workflow_dispatch: inputs: repo: type: string required: false env: - COUNT_LINES_REPO: ${{ inputs.repo || 'kir-dev/cmsch' }} + TARGET_REPO: ${{ inputs.repo || 'kir-dev/cmsch' }} jobs: count-lines: @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - repository: ${{ env.COUNT_LINES_REPO }} + repository: ${{ env.TARGET_REPO }} - uses: kir-dev/automations/actions/count-lines@main id: counter with: @@ -34,7 +34,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - repository: ${{ env.COUNT_LINES_REPO }} + repository: ${{ env.TARGET_REPO }} - uses: kir-dev/automations/actions/count-lines-docker@main id: counter with: diff --git a/.github/workflows/self-prod.yml b/.github/workflows/self-prod.yml index 5071655..ed16304 100644 --- a/.github/workflows/self-prod.yml +++ b/.github/workflows/self-prod.yml @@ -1,14 +1,21 @@ -name: Deployment workflow +name: Deployment on: push: branches: - main - pull_request: - workflow_call: + workflow_dispatch: + inputs: + environment: + description: 'Select the environment to deploy' + required: true + type: choice + options: + - staging + - production jobs: - staging: + depoy: runs-on: ubuntu-latest permissions: @@ -17,9 +24,8 @@ jobs: strategy: matrix: - environment: - - staging - - production + environment: ${{ fromJson( + github.event_name == 'workflow_dispatch' && '[${{ inputs.environment }}]' || '["staging", "production"]') }} max-parallel: 1 environment: ${{ matrix.environment }} @@ -32,7 +38,15 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: kir-dev/automations/actions/infra-build-images@feat/build-docker-actions + + - name: Log into registry ${{ env.DOCKER_REGISTRY }} + uses: docker/login-action@v3 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: ./actions/infra-build-images@feat/build-docker-actions with: registry: ${{ env.DOCKER_REGISTRY }} namespace: ${{ env.DOCKER_NAMESPACE }} diff --git a/scripts/build-docker-actions.sh b/scripts/build-docker-actions.sh index 4e7429c..d60dd6c 100755 --- a/scripts/build-docker-actions.sh +++ b/scripts/build-docker-actions.sh @@ -18,7 +18,7 @@ pushd $CONTEXT for FILE in *.Dockerfile do NAME=${FILE%.Dockerfile} - docker buildx build \ + docker buildx build --load \ --file "$FILE" \ --tag "$DOCKER_REPO/$NAME:$TAG" \ $EXTRA_ARGS \ @@ -26,6 +26,6 @@ do done echo '# Docker images' >> $GITHUB_STEP_SUMMARY -docker images | grep "$DOCKER_REPO" >> $GITHUB_STEP_SUMMARY +docker images "$DOCKER_REPO"/"$NAME"* >> $GITHUB_STEP_SUMMARY popd \ No newline at end of file