Fix build Docker releases (#1783)

* gh act - if

* gh act - if

* gh act - steps

* gh act - steps

* gh act - steps

* name

* name

* reorder

* docker

* timeout

* repo

* show

* show

* ver

* rc

* tag
This commit is contained in:
Jirka Borovec 2020-05-12 12:54:59 +02:00 committed by GitHub
parent 10b16dbfab
commit 35ac30e688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 32 deletions

View File

@ -1,4 +1,5 @@
name: Publish Docker Releases
# https://www.docker.com/blog/first-docker-github-action-is-here
on:
push:
branches:
@ -15,35 +16,35 @@ jobs:
python_version: [3.6, 3.7, 3.8]
pytorch_version: [1.1, 1.2, 1.3, 1.4, 1.5]
steps:
- name: Extract branch name
if: contains(github.ref, 'refs/tags/') != true
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_tag
- name: Extract Tag name
if: contains(github.ref, 'refs/tags')
shell: bash
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/})"
- uses: actions/checkout@v2
- name: Publish Releases to Docker
# only on releases
uses: elgohr/Publish-Docker-Github-Action@2.14
if: contains(github.ref, 'refs/tags/') && !contains(${{ steps.extract_tag.outputs.tag }}, 'rc') && !contains(${{ steps.extract_tag.outputs.tag }}, 'dev')
with:
name: pytorchlightning/pytorch_lightning
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: docker/Dockerfile
buildargs: PYTHON_VERSION=${{ matrix.python_version }},PYTORCH_VERSION=${{ matrix.pytorch_version }},LIGHTNING_VERSION=${{ steps.extract_tag.outputs.tag }}
tags: "${{ steps.extract_tag.outputs.tag }}-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }},stable-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}"
- name: Publish Master
# publish master
uses: elgohr/Publish-Docker-Github-Action@2.14
if: github.event_name == 'push'
with:
name: pytorchlightning/pytorch_lightning
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: docker/Dockerfile
buildargs: PYTHON_VERSION=${{ matrix.python_version }},PYTORCH_VERSION=${{ matrix.pytorch_version }},LIGHTNING_VERSION=${{ steps.extract_branch.outputs.branch }}
tags: "nightly-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}"
- uses: actions/checkout@v2
- name: Publish Master to Docker
# publish master
uses: docker/build-push-action@v1.1.0
if: github.event_name == 'push'
with:
repository: pytorchlightning/pytorch_lightning
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: docker/Dockerfile
buildargs: PYTHON_VERSION=${{ matrix.python_version }},PYTORCH_VERSION=${{ matrix.pytorch_version }}
tags: "nightly-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}"
timeout-minutes: 30
- name: Get release version
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release'
id: get_version
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF##*/})
- name: Publish Releases to Docker
# only on releases
uses: docker/build-push-action@v1.1.0
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release'
with:
repository: pytorchlightning/pytorch_lightning
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: docker/Dockerfile
buildargs: PYTHON_VERSION=${{ matrix.python_version }},PYTORCH_VERSION=${{ matrix.pytorch_version }},LIGHTNING_VERSION=${{ env.RELEASE_VERSION }}
tags: "${{ env.RELEASE_VERSION }}-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }},latest-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}"
timeout-minutes: 30