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: 8.2-fpm-alpine Docker Image CI | |
on: | |
push: | |
# Publish as Docker `latest` image. | |
branches: [ latest ] | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
env: | |
IMAGE_NAME: siomkin/8.2-fpm-alpine | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set version | |
run: | | |
# 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" == "$default-branch" ] && VERSION=latest | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag $IMAGE_NAME | |
- name: Deploy to docker | |
uses: zenato/docker-action@master | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: ${{ env.IMAGE_NAME }} | |
tag: ${{ env.VERSION }} |