ghaction-github-pages/.github/workflows/docker.yml

45 lines
1.1 KiB
YAML
Raw Normal View History

2019-09-02 23:51:26 +08:00
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}" \
2019-09-02 23:55:54 +08:00
--tag "crazymax/ghaction-github-pages:${TAG_NAME:-snapshot}" \
2019-09-02 23:51:26 +08:00
--tag "crazymax/ghaction-github-pages:latest" \
--file Dockerfile .
-
name: Docker Login
if: success() && startsWith(github.ref, 'refs/tags/v')
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
2019-09-02 23:54:09 +08:00
echo "${DOCKER_PASSWORD}" | docker login --username crazymax --password-stdin
2019-09-02 23:51:26 +08:00
-
name: Docker Push
if: success() && startsWith(github.ref, 'refs/tags/v')
run: |
docker push crazymax/ghaction-github-pages