Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use main ci for building docker images #84

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 15 additions & 30 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,20 @@ jobs:
command: |
mise run install
mise run ci
build:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this now no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uptickmetachu we don't want test builds ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess if we have the lifecycle policies.

I don't think its entirely too neccessary but it doesn't hurt too much.

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

Loading