diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 1e5528ec..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: "Build" -#create dependency between release and build -on: - workflow_run: - workflows: ["Release"] # Nome do fluxo de trabalho de release - types: - - completed # Garantir que o build seja executado quando o fluxo de release for concluĂ­do - -permissions: - id-token: write - contents: read - pull-requests: write - -jobs: - build_and_publish: - runs-on: ubuntu-latest - env: - APP_NAME: midaz-console - DOCKERHUB_ORG: lerianstudio - name: Build And Publish Docker Image to Midaz - steps: - - name: Set up GitHub token - id: app-token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_APP_ID }} - private-key: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_PRIVATE_KEY }} - - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - - - name: Set up Node.js 22 - uses: actions/setup-node@v3 - with: - node-version: '22' - - - name: Cache npm dependencies - uses: actions/cache@v3 - with: - path: ~/.npm - key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-modules- - - - name: Install dependencies - run: npm install - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: "${{ secrets.DOCKER_USERNAME }}" - password: "${{ secrets.DOCKER_PASSWORD }}" - - - name: Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.DOCKERHUB_ORG }}/${{ env.APP_NAME }} - tags: | - type=semver,pattern={{version}} - type=ref,event=branch,suffix=-${{ github.sha }} - - - name: Build Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - load: true - tags: ${{ steps.meta.outputs.tags }} - cache-from: type=registry,ref=${{ env.DOCKERHUB_ORG }}/${{ env.APP_NAME }}:latest - build-args: | - GITHUB_TOKEN=${{ steps.app-token.outputs.token }} - - - name: Extract tag name - shell: bash - run: echo "tag=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - id: extract_tag - - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@master - with: - diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index f3e0efe0..00000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,102 +0,0 @@ -name: "Release" - -on: - push: - branches: - - develop - - main - - hotfix/v* - - feature/* - paths-ignore: - - '.gitignore' - - '**/*.env' - - '*.env' - - '**/*.md' - - '*.md' - - '**/*.txt' - - '*.txt' - -permissions: - id-token: write - contents: write - pull-requests: write -#Jobs -jobs: - # integration_tests: - # name: Run Integration Tests - # runs-on: ubuntu-latest - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - - # - name: Cache Node.js modules - # uses: actions/cache@v3 - # with: - # path: ~/.npm - # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - # restore-keys: | - # ${{ runner.os }}-node- - - # - name: Set up Node.js - # uses: actions/setup-node@v3 - # with: - # node-version: '22' - - # - name: Install dependencies - # run: npm ci - - # - name: Run Unit and Integration Tests - # run: npm run test - - publish_release: - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/') || startsWith(github.ref, 'refs/heads/feature/') - - runs-on: ubuntu-latest - #needs: integration_tests - environment: - name: create_release - name: Create Release for Node.js Project - steps: - - name: Create GitHub App Token - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_APP_ID }} - private-key: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_PRIVATE_KEY }} - - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ steps.app-token.outputs.token }} - - - name: Import GPG Key - uses: crazy-max/ghaction-import-gpg@v6 - id: import_gpg - with: - gpg_private_key: ${{ secrets.LERIAN_CI_CD_USER_GPG_KEY }} - passphrase: ${{ secrets.LERIAN_CI_CD_USER_GPG_KEY_PASSWORD }} - git_committer_name: ${{ secrets.LERIAN_CI_CD_USER_NAME }} - git_committer_email: ${{ secrets.LERIAN_CI_CD_USER_EMAIL }} - git_config_global: true - git_user_signingkey: true - git_commit_gpgsign: true - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '22' - - - name: Install dependencies - run: npm ci - - - name: Run Semantic Release - #run: npx semantic-release - run: npx semantic-release --no-ci - env: - GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - GIT_AUTHOR_NAME: ${{ secrets.LERIAN_CI_CD_USER_NAME }} - GIT_AUTHOR_EMAIL: ${{ secrets.LERIAN_CI_CD_USER_EMAIL }} - GIT_COMMITTER_NAME: ${{ secrets.LERIAN_CI_CD_USER_NAME }} - GIT_COMMITTER_EMAIL: ${{ secrets.LERIAN_CI_CD_USER_EMAIL }}