Skip to content

Adding auto releases #41

Adding auto releases

Adding auto releases #41

name: Build and Push Docker image
on:
push:
branches:
- main
tags:
- 'v*'
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Prepare tags
id: prep
run: |
SHA=$(echo ${GITHUB_SHA} | cut -c1-8)
echo ::set-output name=sha::${SHA}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
echo ::set-output name=version::${VERSION}
else
echo ::set-output name=version::0.0.0
fi
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./src/Dockerfile
push: true
tags: |
dzarlax/todoist_bot:latest
dzarlax/todoist_bot:${{ steps.prep.outputs.version }}
dzarlax/todoist_bot:sha-${{ steps.prep.outputs.sha }}