-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (33 loc) · 1.1 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 }}