Skip to content

Commit

Permalink
modify image tag of deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
simonycj committed Sep 29, 2024
1 parent 2d1fa6b commit 3290519
Showing 1 changed file with 41 additions and 39 deletions.
80 changes: 41 additions & 39 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,50 @@ on:
push:
branches:
- main
- 'release/*'
- "release/*"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest

- name: Docker login
env:
DOCKER_USERNAME: ${{ secrets.ALIYUN_REGISTRY_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin registry.cn-shanghai.aliyuncs.com
- name: Extract branch name
id: extract_branch
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV

- name: Extract Tag
id: extract_tag
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}

- name: Run buildx
run: |
tag=latest
if [[ "${{ steps.extract_branch.outputs.branch }}" == "main" ]];then
tag=latest
elif [[ "${{ steps.extract_tag.outputs.version }}" == v* ]]; then
tag="${{ steps.extract_tag.outputs.version }}"
fi
echo extract_tag ${{ steps.extract_tag.outputs.version }}
echo extract_branch ${{ steps.extract_branch.outputs.branch }}
echo current tag is ${tag}
docker buildx build --platform linux/amd64,linux/arm64 --push -f deploy/docker/Dockerfile -t registry.cn-shanghai.aliyuncs.com/openhydra/aes-ai-tutor:${tag} .
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest

- name: Docker login
env:
DOCKER_USERNAME: ${{ secrets.ALIYUN_REGISTRY_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin registry.cn-shanghai.aliyuncs.com
- name: Extract branch name
id: extract_branch
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV

- name: Extract Tag
id: extract_tag
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}

- name: Run buildx
run: |
tag=latest
if [[ "${{ steps.extract_branch.outputs.branch }}" == "main" ]];then
tag=latest
elif [[ "${{ steps.extract_tag.outputs.version }}" == v* ]]; then
tag="${{ steps.extract_tag.outputs.version }}"
else
tag="${{ steps.extract_branch.outputs.branch }}"
fi
echo extract_tag ${{ steps.extract_tag.outputs.version }}
echo extract_branch ${{ steps.extract_branch.outputs.branch }}
echo current tag is ${tag}
docker buildx build --platform linux/amd64,linux/arm64 --push -f deploy/docker/Dockerfile -t registry.cn-shanghai.aliyuncs.com/openhydra/aes-ai-tutor:${tag} .

0 comments on commit 3290519

Please sign in to comment.