Docker Image CI #1843
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: Docker Image CI | |
on: | |
push: {} | |
pull_request: {} | |
schedule: | |
- cron: '5 4 * * *' | |
env: | |
DOCKER_REPO: jonoh/openvpn-proxy | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build | |
run: docker build . --tag ci | |
- name: Docker Login | |
if: github.ref == 'refs/heads/master' | |
uses: Azure/docker-login@v1 | |
with: | |
username: jonoh | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Release | |
if: github.ref == 'refs/heads/master' | |
env: | |
OPENVPN_VERSION_RE: ([0-9]\.[0-9]\.[0-9]) | |
run: | | |
docker tag ci "${DOCKER_REPO}:latest" | |
if [[ "$(docker run --rm --entrypoint openvpn ci --version)" =~ ${OPENVPN_VERSION_RE} ]]; then | |
docker tag ci "${DOCKER_REPO}:${BASH_REMATCH[1]}" | |
fi | |
docker push "$DOCKER_REPO" |