Docker tag latest #7
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
name: Docker tag latest | |
on: | |
# push: | |
# branches: | |
# - main | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel. | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract build args | |
# Extract version from branch name | |
# Example: branch name `release/1.0.0` sets up env.RELEASE_VERSION=1.0.0 | |
run: | | |
RELEASE_VERSION=${GITHUB_REF_NAME#release/} | |
echo version111: ${RELEASE_VERSION} | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Tag latest image | |
run: | | |
RELEASE_VERSION=${GITHUB_REF_NAME#release/} | |
echo version: ${RELEASE_VERSION} | |
docker pull --platform=linux/arm64 bytebase/bytebase:${RELEASE_VERSION} | |
docker pull --platform=linux/amd64 bytebase/bytebase:${RELEASE_VERSION} | |
docker tag bytebase/bytebase:${RELEASE_VERSION} bytebase/bytebase:latest | |
docker push bytebase/bytebase:latest |