This repository has been archived by the owner on Feb 19, 2024. It is now read-only.
forked from openyurtio/openyurt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
114 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,59 @@ | ||
name: Build Docker Image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
folder: | ||
required: true | ||
type: string | ||
repo: | ||
required: true | ||
type: string | ||
tag: | ||
required: false | ||
type: string | ||
default: test$(git rev-parse --short HEAD) | ||
commit: | ||
required: false | ||
type: string | ||
default: $(git rev-parse --short HEAD) | ||
runs-on: | ||
required: false | ||
type: string | ||
default: ubuntu-latest | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ inputs.runs-on }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
token: ${{ secrets.SUBMODULES_GITHUB_TOKEN }} | ||
- name: Install awscli | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install awscli | ||
- 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: ${{ vars.AWS_REGION }} | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
- name: Build and push the Docker image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
run: | | ||
set -x | ||
docker build . --file ${{ inputs.folder }}/Dockerfile \ | ||
--tag ${{ inputs.repo }}:${{ inputs.tag }} \ | ||
--build-arg GIT_COMMIT=${{ inputs.commit }} \ | ||
--build-arg REPO=$ECR_REGISTRY/ecr-public | ||
echo "tagging container image with ${{ inputs.repo }}:${{ inputs.tag }}}" | ||
docker tag ${{ inputs.repo }}:${{ inputs.tag }} $ECR_REGISTRY/${{ inputs.repo }}:${{ inputs.tag }} | ||
docker push $ECR_REGISTRY/${{ inputs.repo }}:${{ inputs.tag }} |
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,16 @@ | ||
name: pr | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "**" | ||
branches: ["**"] | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build-docker-image.yaml | ||
secrets: inherit | ||
with: | ||
folder: ./ | ||
repo: raven-manager | ||
|
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,22 @@ | ||
name: push | ||
|
||
on: | ||
push: | ||
paths: | ||
- "**" | ||
branches: ["main"] | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build-docker-image.yaml | ||
secrets: inherit | ||
with: | ||
folder: ./ | ||
repo: raven-manager | ||
tag: latest | ||
|
||
|
||
|
||
|
||
|
||
|
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,17 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build-docker-image.yaml | ||
secrets: inherit | ||
with: | ||
folder: ./ | ||
repo: raven-manager | ||
tag: ${GITHUB_REF##*/} | ||
commit: ${GITHUB_REF##*/} | ||
|