-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from jwcesign/main
ci: add release image build
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Release image build | ||
|
||
on: | ||
# Trigger on workflow_dispatch (manual trigger) | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Tag to build (e.g., v1.0.0)' | ||
required: false | ||
# Trigger on push for new tags | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
image-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set tag from inputs or Git tag | ||
id: set-tag | ||
run: | | ||
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | ||
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_ENV | ||
elif [ "${{ github.event_name }}" == "push" ]; then | ||
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
else | ||
echo "No valid trigger for building an image." | ||
exit 1 | ||
fi | ||
shell: bash | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23' | ||
cache: false | ||
|
||
- name: Config env | ||
run: | | ||
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_AK }}" >> $GITHUB_ENV | ||
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SK }}" >> $GITHUB_ENV | ||
echo "AWS_DEFAULT_REGION=us-east-2" >> $GITHUB_ENV | ||
- name: AWS CLI Init | ||
uses: unfor19/install-aws-cli-action@v1 | ||
|
||
- name: Config ECR | ||
run: | | ||
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/cloudpilotai | ||
- uses: ko-build/[email protected] | ||
|
||
- name: Build and publish image | ||
run: | | ||
export KO_DOCKER_REPO=public.ecr.aws/cloudpilotai/alibabacloud/karpenter | ||
export IMAGE_TAG=${{ env.tag }} | ||
ko build --bare github.com/cloudpilot-ai/karpenter-provider-alibabacloud/cmd/controller -t $IMAGE_TAG |