From fa82294d68b9a2b734ac95134f589b6f9a3c258e Mon Sep 17 00:00:00 2001 From: leoBitto Date: Sat, 12 Oct 2024 17:28:40 +0200 Subject: [PATCH] final step of test for build and push --- .github/workflows/build_and_push.yml | 6 +- .github/workflows/non_f-build_and_push.yml | 65 ------------------- .github/workflows/non_f-build_test.yml | 74 ---------------------- 3 files changed, 2 insertions(+), 143 deletions(-) delete mode 100644 .github/workflows/non_f-build_and_push.yml delete mode 100644 .github/workflows/non_f-build_test.yml diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml index 94760c8..b08491d 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/build_and_push.yml @@ -110,13 +110,11 @@ jobs: run: | echo "OWNER_LC=${{ github.repository_owner }}" >>${GITHUB_ENV} echo "REPO_NAME_LC=${{ github.repository }}" >>${GITHUB_ENV} - echo ${OWNER_LC,,} - echo ${REPO_NAME_LC,,} - name: Tag image for GHCR run: | - docker tag webapp_django ${{ env.REGISTRY }}/${OWNER_LC,,}/${REPO_NAME_LC,,}:${{ inputs.tag }} + docker tag webapp_django ${{ env.REGISTRY }}/${REPO_NAME_LC,,}:${{ inputs.tag }} - name: Log in to GitHub Container Registry (GHCR) @@ -125,4 +123,4 @@ jobs: - name: Push image to GHCR run: | - docker push ${{ env.REGISTRY }}/${OWNER_LC,,}/${REPO_NAME_LC,,}:${{ inputs.tag }} + docker push ${{ env.REGISTRY }}/${REPO_NAME_LC,,}:${{ inputs.tag }} diff --git a/.github/workflows/non_f-build_and_push.yml b/.github/workflows/non_f-build_and_push.yml deleted file mode 100644 index d1ad9d1..0000000 --- a/.github/workflows/non_f-build_and_push.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: old - Build and Push to GHCR - -on: - workflow_dispatch: - inputs: - tag: - description: "Docker image tag" - required: true - default: "latest" - -env: - REGISTRY: ghcr.io - -jobs: - build_and_push: - runs-on: ubuntu-latest - - steps: - # Step 1: Checkout del repository - - name: Checkout the repo - uses: actions/checkout@v4 - with: - submodules: recursive - token: ${{ secrets.GITHUB_TOKEN }} - - # Step 2: Creazione dei file di configurazione - - name: Call reusable workflow to create config files - uses: ./.github/workflows/create-config-files.yml - with: - repo_name: ${{ env.REPO_NAME }} - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - private_key: ${{ secrets.PRIVATE_KEY }} - - # Step 3: Mostra il contenuto del file di configurazione - - name: Display content of .env file - run: cat ./config/.env - - # Step 4: Build dell'immagine Docker - - name: Build Docker image using Docker Compose - run: docker-compose -f docker-compose.dev.yml build - - # Step 3.1: Verifica che l'immagine Docker sia stata creata - - name: Verify Docker image creation - run: docker images - - # Step 3.2: Conversione in minuscolo del nome del repository e del proprietario - - name: Set lower case owner and repo names - run: | - echo "OWNER_LC=${{ github.repository_owner,, }}" >>${GITHUB_ENV} - echo "REPO_NAME_LC=${{ github.repository,, }}" >>${GITHUB_ENV} - - # Step 4: Tag dell'immagine per GHCR - - name: Tag image for GHCR - run: | - docker tag webapp_django ${{ env.REGISTRY }}/${OWNER_LC}/${REPO_NAME_LC}:${{ inputs.tag }} - - # Step 5: Login in GHCR - - name: Log in to GitHub Container Registry (GHCR) - run: echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - # Step 6: Push dell'immagine su GHCR - - name: Push image to GHCR - run: | - docker push ${{ env.REGISTRY }}/${OWNER_LC}/${REPO_NAME_LC}:${{ inputs.tag }} diff --git a/.github/workflows/non_f-build_test.yml b/.github/workflows/non_f-build_test.yml deleted file mode 100644 index 5c39fc5..0000000 --- a/.github/workflows/non_f-build_test.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: old - Build and Test Config - -on: - workflow_dispatch: # Permette di lanciare manualmente il workflow per il test - -env: - REPO_NAME: DjangoForge - HOST: ${{ secrets.HOST }} - USERNAME: ${{ secrets.USERNAME }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - DEBUG: "False" # Puoi modificarlo a "True" se vuoi testare in modalità debug - SECRET_KEY: ${{ secrets.SECRET_KEY }} - DJANGO_ALLOWED_HOSTS: ${{ secrets.DJANGO_ALLOWED_HOSTS }} - SQL_ENGINE: ${{ secrets.SQL_ENGINE }} - DATABASE: ${{ secrets.DATABASE }} - POSTGRES_DB: ${{ secrets.POSTGRES_DB }} - POSTGRES_USER: ${{ secrets.POSTGRES_USER }} - POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} - SQL_HOST: ${{ secrets.SQL_HOST }} - SQL_PORT: ${{ secrets.SQL_PORT }} - GOLD_POSTGRES_DB: ${{ secrets.GOLD_POSTGRES_DB }} - GOLD_POSTGRES_USER: ${{ secrets.GOLD_POSTGRES_USER }} - GOLD_POSTGRES_PASSWORD: ${{ secrets.GOLD_POSTGRES_PASSWORD }} - GOLD_SQL_HOST: ${{ secrets.GOLD_SQL_HOST }} - GOLD_SQL_PORT: ${{ secrets.GOLD_SQL_PORT }} - EMAIL: ${{ secrets.EMAIL }} - DOMAIN: ${{ secrets.DOMAIN }} - -jobs: - test-create-config: - runs-on: ubuntu-latest - - steps: - # Step 1: Checkout del repository - - name: Checkout the repo - uses: actions/checkout@v4 - with: - submodules: recursive - token: ${{ secrets.GITHUB_TOKEN }} - - # Step 1: Set Environment Variables - - name: Set environment variables - run: | - echo "Repository Name: ${REPO_NAME}" - echo "Host: ${HOST}" - echo "Username: ${USERNAME}" - echo "Debug Mode: ${DEBUG}" - echo "Domain: ${DOMAIN}" - - create_configuration: - uses: ./.github/workflows/create_cfg_files.yml - with: - repo_name: ${{ env.REPO_NAME }} - host: ${{ env.HOST }} - username: ${{ env.USERNAME }} - private_key: ${{ env.PRIVATE_KEY }} - debug: ${{ env.DEBUG }} - secret_key: ${{ env.SECRET_KEY }} - django_allowed_hosts: ${{ env.DJANGO_ALLOWED_HOSTS }} - sql_engine: ${{ env.SQL_ENGINE }} - database: ${{ env.DATABASE }} - postgres_db: ${{ env.POSTGRES_DB }} - postgres_user: ${{ env.POSTGRES_USER }} - postgres_password: ${{ env.POSTGRES_PASSWORD }} - sql_host: ${{ env.SQL_HOST }} - sql_port: ${{ env.SQL_PORT }} - gold_postgres_db: ${{ env.GOLD_POSTGRES_DB }} - gold_postgres_user: ${{ env.GOLD_POSTGRES_USER }} - gold_postgres_password: ${{ env.GOLD_POSTGRES_PASSWORD }} - gold_sql_host: ${{ env.GOLD_SQL_HOST }} - gold_sql_port: ${{ env.GOLD_SQL_PORT }} - email: ${{ env.EMAIL }} - domain: ${{ env.DOMAIN }} -