diff --git a/.github/workflows/build-staging-and-deploy-aws.yml b/.github/workflows/build-staging-and-deploy-aws.yml index c6e9cc127..24c613c6c 100644 --- a/.github/workflows/build-staging-and-deploy-aws.yml +++ b/.github/workflows/build-staging-and-deploy-aws.yml @@ -6,83 +6,83 @@ permissions: contents: read jobs: - # infisical-image: - # name: Build backend image - # runs-on: ubuntu-latest - # steps: - # - name: โ˜๏ธ Checkout source - # uses: actions/checkout@v3 - # - name: Configure AWS credentials - # uses: aws-actions/configure-aws-credentials@v1 - # with: - # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_FOR_ECR }} - # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_ECR }} - # aws-region: us-east-1 - # - name: Login to Amazon ECR - # id: login-ecr - # uses: aws-actions/amazon-ecr-login@v1 - # - name: ๐Ÿ“ฆ Install dependencies to test all dependencies - # run: npm ci --only-production - # working-directory: backend - # # - name: ๐Ÿงช Run tests - # # run: npm run test:ci - # # working-directory: backend - # - name: Save commit hashes for tag - # id: commit - # uses: pr-mpt/actions-commit-hash@v2 - # - name: ๐Ÿ”ง Set up Docker Buildx - # uses: docker/setup-buildx-action@v2 - # - name: ๐Ÿ‹ Login to Docker Hub - # uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} - # - name: Set up Depot CLI - # uses: depot/setup-action@v1 - # - name: ๐Ÿ“ฆ Build backend and export to Docker - # uses: depot/build-push-action@v1 - # with: - # project: 64mmf0n610 - # token: ${{ secrets.DEPOT_PROJECT_TOKEN }} - # load: true - # context: . - # file: Dockerfile.standalone-infisical - # tags: infisical/infisical:test - # - name: ๐Ÿ—๏ธ Build backend and push to docker hub - # uses: depot/build-push-action@v1 - # with: - # project: 64mmf0n610 - # token: ${{ secrets.DEPOT_PROJECT_TOKEN }} - # push: true - # context: . - # file: Dockerfile.standalone-infisical - # tags: | - # infisical/staging_infisical:${{ steps.commit.outputs.short }} - # infisical/staging_infisical:latest - # platforms: linux/amd64,linux/arm64 - # build-args: | - # POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} - # INFISICAL_PLATFORM_VERSION=${{ steps.extract_version.outputs.version }} + infisical-image: + name: Build backend image + runs-on: ubuntu-latest + steps: + - name: โ˜๏ธ Checkout source + uses: actions/checkout@v3 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_FOR_ECR }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_ECR }} + aws-region: us-east-1 + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + - name: ๐Ÿ“ฆ Install dependencies to test all dependencies + run: npm ci --only-production + working-directory: backend + # - name: ๐Ÿงช Run tests + # run: npm run test:ci + # working-directory: backend + - name: Save commit hashes for tag + id: commit + uses: pr-mpt/actions-commit-hash@v2 + - name: ๐Ÿ”ง Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: ๐Ÿ‹ Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Depot CLI + uses: depot/setup-action@v1 + - name: ๐Ÿ“ฆ Build backend and export to Docker + uses: depot/build-push-action@v1 + with: + project: 64mmf0n610 + token: ${{ secrets.DEPOT_PROJECT_TOKEN }} + load: true + context: . + file: Dockerfile.standalone-infisical + tags: infisical/infisical:test + - name: ๐Ÿ—๏ธ Build backend and push to docker hub + uses: depot/build-push-action@v1 + with: + project: 64mmf0n610 + token: ${{ secrets.DEPOT_PROJECT_TOKEN }} + push: true + context: . + file: Dockerfile.standalone-infisical + tags: | + infisical/staging_infisical:${{ steps.commit.outputs.short }} + infisical/staging_infisical:latest + platforms: linux/amd64,linux/arm64 + build-args: | + POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} + INFISICAL_PLATFORM_VERSION=${{ steps.extract_version.outputs.version }} - # postgres-migration: - # name: Run latest migration files - # runs-on: ubuntu-latest - # needs: [infisical-image] - # steps: - # - name: Checkout code - # uses: actions/checkout@v2 - # - name: Setup Node.js environment - # uses: actions/setup-node@v2 - # with: - # node-version: "20" - # - name: Change directory to backend and install dependencies - # env: - # DB_CONNECTION_URI: ${{ secrets.AWS_DB_CONNECTION_URI }} - # run: | - # cd backend - # npm install - # npm run migration:latest + postgres-migration: + name: Run latest migration files + runs-on: ubuntu-latest + needs: [infisical-image] + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Node.js environment + uses: actions/setup-node@v2 + with: + node-version: "20" + - name: Change directory to backend and install dependencies + env: + DB_CONNECTION_URI: ${{ secrets.AWS_DB_CONNECTION_URI }} + run: | + cd backend + npm install + npm run migration:latest gamma-deployment: name: Deploy to gamma runs-on: ubuntu-latest