Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
suyuee committed Oct 13, 2023
1 parent 2a840b2 commit 310f715
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build-docer-image.yaml
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 }}
16 changes: 16 additions & 0 deletions .github/workflows/pr.yaml
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

22 changes: 22 additions & 0 deletions .github/workflows/push.yaml
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






17 changes: 17 additions & 0 deletions .github/workflows/release.yaml
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##*/}

0 comments on commit 310f715

Please sign in to comment.