46 lines
1.2 KiB
YAML
46 lines
1.2 KiB
YAML
|
name: docker
|
||
|
|
||
|
on:
|
||
|
pull_request:
|
||
|
branches:
|
||
|
- master
|
||
|
push:
|
||
|
branches:
|
||
|
- master
|
||
|
tags:
|
||
|
- v*
|
||
|
|
||
|
jobs:
|
||
|
release:
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
-
|
||
|
name: Set TAG_NAME
|
||
|
if: startsWith(github.ref, 'refs/tags/')
|
||
|
run: |
|
||
|
echo "##[set-env name=TAG_NAME;]${GITHUB_REF#refs/tags/}"
|
||
|
-
|
||
|
name: Checkout
|
||
|
uses: actions/checkout@v1
|
||
|
-
|
||
|
name: Docker Build
|
||
|
run: |
|
||
|
docker build \
|
||
|
--build-arg "VERSION=${TAG_NAME}" \
|
||
|
--tag "crazymax/ghaction-github-pages:${TAG_NAME}" \
|
||
|
--tag "crazymax/ghaction-github-pages:latest" \
|
||
|
--file Dockerfile .
|
||
|
-
|
||
|
name: Docker Login
|
||
|
if: success() && startsWith(github.ref, 'refs/tags/v')
|
||
|
env:
|
||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
run: |
|
||
|
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
||
|
-
|
||
|
name: Docker Push
|
||
|
if: success() && startsWith(github.ref, 'refs/tags/v')
|
||
|
run: |
|
||
|
docker push crazymax/ghaction-github-pages
|