diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index 06816edb..a921f7cb 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -5,7 +5,6 @@ on: workflows: [Release Image (Development)] branches: [dev] types: [completed] - workflow_dispatch: jobs: deploy-dev: runs-on: ubuntu-latest @@ -16,42 +15,10 @@ jobs: name: development url: https://api.development.basedosdados.org steps: - - name: Download branch name - uses: actions/github-script@v6 - if: ${{ github.event_name == 'workflow_run' }} - with: - script: | - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "branch" - })[0]; - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/artifact.zip`, Buffer.from(download.data)); - - name: Extract branch name - if: ${{ github.event_name == 'workflow_run' }} - run: unzip artifact.zip - - name: Read branch name - id: extract_branch - run: | - if [ ! -f "branch" ]; then - echo "branch=main" >> "$GITHUB_OUTPUT" - else - echo "branch=$(cat branch)" >> "$GITHUB_OUTPUT" - fi - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ steps.extract_branch.outputs.branch }} + ref: dev - name: Import secrets from Vault id: import_secrets uses: hashicorp/vault-action@v2.8.0 diff --git a/.github/workflows/deploy-prod.yaml b/.github/workflows/deploy-prod.yaml index 510f8560..abba4734 100644 --- a/.github/workflows/deploy-prod.yaml +++ b/.github/workflows/deploy-prod.yaml @@ -5,7 +5,6 @@ on: workflows: [Release Image (Production)] branches: [main] types: [completed] - workflow_dispatch: jobs: deploy-prod: runs-on: ubuntu-latest diff --git a/.github/workflows/deploy-staging.yaml b/.github/workflows/deploy-staging.yaml index d6b90d7a..b3c1d0f4 100644 --- a/.github/workflows/deploy-staging.yaml +++ b/.github/workflows/deploy-staging.yaml @@ -19,7 +19,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: main + ref: staging - name: Import secrets from Vault id: import_secrets uses: hashicorp/vault-action@v2.8.0 diff --git a/.github/workflows/release-dev.yaml b/.github/workflows/release-dev.yaml index 25092332..4be5fcf6 100644 --- a/.github/workflows/release-dev.yaml +++ b/.github/workflows/release-dev.yaml @@ -8,22 +8,11 @@ jobs: release-docker: name: Release Image runs-on: ubuntu-latest - if: | - github.event_name == 'workflow_dispatch' || - contains(github.event.pull_request.labels.*.name, 'preview') steps: - - name: Select branch - id: select_branch - run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - echo "branch=main" >> $GITHUB_OUTPUT - else - echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT - fi - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ steps.select_branch.outputs.branch }} + ref: dev - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: @@ -43,13 +32,4 @@ jobs: org.opencontainers.image.revision=${{ github.sha }} build-args: | BUILDKIT_INLINE_CACHE=1 - - name: Save branch name artifact - run: | - mkdir -p ./branch - echo -n ${{ steps.select_branch.outputs.branch }} > ./branch/branch - - name: Upload branch name artifact - uses: actions/upload-artifact@v3 - with: - name: branch - path: branch/ - retention-days: 1 + diff --git a/.github/workflows/release-staging.yaml b/.github/workflows/release-staging.yaml index 0a64e5da..15bd6c92 100644 --- a/.github/workflows/release-staging.yaml +++ b/.github/workflows/release-staging.yaml @@ -12,7 +12,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: main + ref: staging - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: