Auto Build and Push image #78
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
# Auto build and push docker image to docker hub when releasing tags | |
--- | |
name: Auto Build and Push image | |
on: | |
create | |
jobs: | |
publish_image: | |
name: Build and Push aeraki image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/[email protected] | |
with: | |
submodules: recursive | |
- name: Extract Tags name | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
id: tag_env | |
shell: bash | |
run: | | |
echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/})" | |
- name: Extract Tags Type | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
id: tag_type | |
shell: bash | |
run: | | |
echo "##[set-output name=version;]$(echo ${GITHUB_REF#refs/tags/})" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Aeraki Docker Image | |
if: ${{ startsWith(steps.tag_type.outputs.version, 'aeraki/') }} | |
run: | | |
make docker-build tag=${{ steps.tag_env.outputs.version }} | |
- name: Push Aeraki Docker image | |
if: ${{ startsWith(steps.tag_type.outputs.version, 'aeraki/') }} | |
run: | | |
docker push ghcr.io/aeraki-mesh/aeraki:${{ steps.tag_env.outputs.version }} |