Skip to content

Commit

Permalink
chore: Use our default "ci" reusable github actions workflow to build…
Browse files Browse the repository at this point in the history
… docker images
  • Loading branch information
mdesouky committed Oct 24, 2024
1 parent 331bbc9 commit edbec1d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
46 changes: 16 additions & 30 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,24 @@ permissions:
env:
MISE_PYTHON_COMPILE: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_IAM_ROLE: ""

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
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,19 @@ 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-repository: "305686791668.dkr.ecr.ap-southeast-2.amazonaws.com/gitops"
command: echo $SECRET_ENV | base64 -d > cluster.key

0 comments on commit edbec1d

Please sign in to comment.