Ci centos eol #209
Workflow file for this run
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 | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: hybridsql-base | |
jobs: | |
# Push image to GitHub Packages. | |
# See also https://docs.docker.com/docker-hub/builds/ | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
- name: Log into ghcr registry | |
if: github.event_name == 'push' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Decide the Tag | |
if: github.event_name == 'push' | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=latest | |
echo "TAGS=$IMAGE_ID:$VERSION" >> $GITHUB_ENV | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
- name: Decide Push | |
run: | | |
if [[ ${{ github.event_name }} = 'push' ]]; then | |
echo "PUSH=true" >> $GITHUB_ENV | |
else | |
echo "PUSH=false" >> $GITHUB_ENV | |
fi | |
- name: Build And Push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: ${{ env.PUSH }} | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ env.TAGS }} |