Push to Docker.io #31
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: Push to Docker.io | |
on: workflow_dispatch | |
jobs: | |
install: | |
name: Build & Deploy in docker.io | |
runs-on: [ ubuntu-latest ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Get version | |
id: vars | |
run: echo ::set-output name=version::$(cat VERSION) | |
- name: Check Tag | |
id: check-tag | |
run: | | |
if [[ ${{ steps.vars.outputs.version }} =~ .*\-dev$ ]]; then | |
echo "::set-output name=dev::true" | |
else | |
echo "::set-output name=dev::false" | |
fi | |
# Production versions | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
if: steps.check-tag.outputs.dev == 'false' | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: true | |
tags: | | |
vingerha/gazpar_2_mqtt_dev:latest | |
vingerha/gazpar_2_mqtt_dev:${{ steps.vars.outputs.version }} | |
# Development versions | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
if: steps.check-tag.outputs.dev == 'true' | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
vingerha/gazpar_2_mqtt_dev:${{ steps.vars.outputs.version }} |