Update docker-image.yml #42
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: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Declare env variables | |
id: vars | |
shell: bash | |
run: | | |
GITHUB_REF=${GITHUB_REF#refs/tags/} | |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
CURRENT_VERSION=`grep -o "'.*'" nseta/__init__.py | sed "s/'//g"` | |
THIS_VERSION=${CURRENT_VERSION}.${{github.run_number}} | |
echo "##[set-output name=THIS_VERSION;]$(echo ${THIS_VERSION})" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Publish latest image to Docker Hub | |
run: | | |
docker build . -f Dockerfile_talib_debian_gnu_linux -t pkjmesra/ta-lib-debian_gnu_linux:latest | |
docker push pkjmesra/ta-lib-debian_gnu_linux:latest | |
docker build . -f Dockerfile -t pkjmesra/nseta:latest | |
docker push pkjmesra/nseta:latest | |
- name: Publish release version image to Docker Hub | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
docker build . -f Dockerfile -t pkjmesra/nseta:${{ steps.vars.outputs.THIS_VERSION }} | |
docker push pkjmesra/nseta:${{ steps.vars.outputs.THIS_VERSION }} |