diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6b73e8b..6a1a34f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,36 +17,21 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - push_to_registry: - name: Push Docker image to Docker Hub - runs-on: ubuntu-latest - steps: - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ap-southeast-2 - - - name: Docker Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Check out the repo - uses: actions/checkout@v3 - - - name: Pull latest image. Build docker image and publish it. - env: - latest_image: 305686791668.dkr.ecr.ap-southeast-2.amazonaws.com/gitops:latest - current_image: 305686791668.dkr.ecr.ap-southeast-2.amazonaws.com/gitops:${{github.event.release.tag_name}} - run: | - echo ${{secrets.CLUSTER_KEY}} | base64 -d > cluster.key - docker pull $latest_image - docker build -t $latest_image --cache-from $latest_image . - docker push $latest_image - docker tag $latest_image $current_image - docker push $current_image - echo "Published image at: $current_image" + build: + name: Build and Push Docker Image + uses: uptick/actions/.github/workflows/ci.yaml@main + secrets: + SECRET_ENV: "${{ secrets.CLUSTER_KEY }}" + #https://github.com/uptick/actions/blob/main/.github/workflows/ci.yaml + with: + aws-iam-role-arn: "arn:aws:iam::305686791668:role/default-github-actions-ci-role" + docker-enabled: true + docker-context: "." + docker-tag: ${{github.event.release.tag_name}} + docker-tag-latest: true + docker-image-platforms: linux/amd64 + docker-repository: "305686791668.dkr.ecr.ap-southeast-2.amazonaws.com/gitops" + command: echo $SECRET_ENV | base64 -d > cluster.key publish_helm_chart: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4859404..413a892 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,3 +24,20 @@ jobs: command: | mise run install mise run ci + build: + name: Build and Push Docker Image + uses: uptick/actions/.github/workflows/ci.yaml@main + secrets: + SECRET_ENV: "${{ secrets.CLUSTER_KEY }}" + #https://github.com/uptick/actions/blob/main/.github/workflows/ci.yaml + with: + aws-iam-role-arn: "arn:aws:iam::305686791668:role/default-github-actions-ci-role" + docker-enabled: true + docker-context: "." + docker-prefix: test + docker-tag-latest: false + docker-image-platforms: linux/amd64 + docker-push: false + docker-repository: "305686791668.dkr.ecr.ap-southeast-2.amazonaws.com/gitops" + command: echo $SECRET_ENV | base64 -d > cluster.key +