Update version. #148
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: Build and Push Docker Image | |
on: | |
# To enable manual triggering of this workflow | |
workflow_dispatch: | |
# Trigger for pushes to master and tags | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*.*.*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
IMAGE_NAME: index.docker.io/metacall/core | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Login to DockerHub | |
run: docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" -p "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | |
- name: Pull MetaCall Docker Images | |
run: bash ./docker-compose.sh pull | |
- name: Build MetaCall Docker Images | |
run: bash ./docker-compose.sh build | |
# TODO: Build with alpine and provide multiple tags (debian & alpine) once all tests pass | |
- name: Push MetaCall Docker Image to DockerHub | |
run: | | |
if [[ "${{ github.ref == 'refs/heads/master' }}" = true ]]; then | |
bash ./docker-compose.sh push | |
elif [[ "${{ contains(github.ref, 'refs/tags/') }}" = true ]]; then | |
bash ./docker-compose.sh version | |
else | |
echo "Failed to push the docker images" | |
exit 1 | |
fi | |
- name: Logout from DockerHub | |
run: docker logout |