diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 77905254..afbf1df7 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,9 +10,10 @@ on: # - '*' jobs: - test: + lint_test: uses: babylonlabs-io/.github/.github/workflows/reusable_node_lint_test.yml@hiep/add-nodejs-workflows docker_build: + needs: [lint_test] runs-on: ubuntu-22.04 strategy: matrix: @@ -35,7 +36,7 @@ jobs: uses: docker/build-push-action@v6 with: tags: simple-staking:${{ github.sha }} - outputs: type=docker,dest=/tmp/simple-staking.tar + outputs: type=docker,dest=/tmp/simple-staking-${{ matrix.environment }}.tar build-args: | NEXT_PUBLIC_MEMPOOL_API=${{ vars.NEXT_PUBLIC_MEMPOOL_API }} NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }} @@ -46,7 +47,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: simple-staking - path: /tmp/simple-staking.tar + path: /tmp/simple-staking-${{ matrix.environment }}.tar dockerhub_publish: runs-on: ubuntu-22.04 @@ -59,7 +60,7 @@ jobs: path: /tmp/ - name: Load Docker image - run: docker load -i /tmp/simple-staking.tar + run: docker load -i /tmp/simple-staking-${{ matrix.environment }}.tar - name: Login to Docker Hub uses: docker/login-action@v3 @@ -69,7 +70,7 @@ jobs: - name: Push Docker image with SHA run: | - docker tag simple-staking:${{ github.sha }} ${{ vars.DOCKERHUB_REGISTRY_ID }}/simple-staking:${{ github.sha }} + docker tag simple-staking:${{ github.sha }} ${{ vars.DOCKERHUB_REGISTRY_ID }}/simple-staking:${{ github.sha }}-${{ matrix.environment }} docker push ${{ vars.DOCKERHUB_REGISTRY_ID }}/simple-staking:${{ github.sha }}-${{ matrix.environment }} - name: Push Docker image with Tag @@ -89,7 +90,7 @@ jobs: path: /tmp/ - name: Load Docker image - run: docker load -i /tmp/simple-staking.tar + run: docker load -i /tmp/simple-staking-${{ matrix.environment }}.tar - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 @@ -104,15 +105,11 @@ jobs: - name: Push Docker image with SHA run: | - docker tag simple-staking:${{ github.sha }} ${{ vars.AWS_ECR_REGISTRY_ID }}/simple-staking:${{ github.sha }} + docker tag simple-staking:${{ github.sha }} ${{ vars.AWS_ECR_REGISTRY_ID }}/simple-staking:${{ github.sha }}-${{ matrix.environment }} docker push ${{ vars.AWS_ECR_REGISTRY_ID }}/simple-staking:${{ github.sha }}-${{ matrix.environment }} - name: Push Docker image with Tag if: startsWith(github.ref, 'refs/tags/') run: | docker tag simple-staking:${{ github.sha }} ${{ vars.AWS_ECR_REGISTRY_ID }}/simple-staking:${{ github.ref_name }}-${{ matrix.environment }} - docker push ${{ vars.AWS_ECR_REGISTRY_ID }}/simple-staking:${{ github.ref_name }}-${{ matrix.environment }} - - - - + docker push ${{ vars.AWS_ECR_REGISTRY_ID }}/simple-staking:${{ github.ref_name }}-${{ matrix.environment }} \ No newline at end of file