Build and Publish Docker #169
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: Build and Publish Docker | |
on: workflow_dispatch | |
jobs: | |
publish-image: | |
runs-on: ubuntu-latest | |
env: | |
OPENBBTERMINAL_DOCKER_GITHUB_REPOSITORY: ${{ github.repository }} | |
OPENBB_LOGGING_APP_NAME: "gst_docker" | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup commit hash | |
run: | | |
echo "OPENBB_LOGGING_COMMIT_HASH=sha:$(git rev-parse --short=8 "$GITHUB_SHA")" >> $GITHUB_ENV | |
- name: Build env file | |
run: | | |
echo "OPENBB_LOGGING_APP_NAME='${OPENBB_LOGGING_APP_NAME}'" > openbb_terminal/.env | |
echo "OPENBB_LOGGING_COMMIT_HASH='${OPENBB_LOGGING_COMMIT_HASH}'" >> openbb_terminal/.env | |
cat openbb_terminal/.env | |
- name: Building the Docker image | |
run: | | |
source build/docker/compose.env | |
source build/docker/build.sh | |
echo "OPENBBTERMINAL_DOCKER_POETRY_IMAGE=$OPENBBTERMINAL_DOCKER_POETRY_IMAGE" >> $GITHUB_ENV | |
echo "OPENBBTERMINAL_DOCKER_POETRY_IMAGE_LATEST=$OPENBBTERMINAL_DOCKER_POETRY_IMAGE_LATEST" >> $GITHUB_ENV | |
- name: Publishing the Docker image (release version) | |
run: | | |
docker push "${OPENBBTERMINAL_DOCKER_POETRY_IMAGE}" | |
if: startsWith(github.ref, 'refs/heads/main') | |
- name: Publishing the latest Docker image | |
run: | | |
docker push "${OPENBBTERMINAL_DOCKER_POETRY_IMAGE_LATEST}" | |
if: startsWith(github.ref, 'refs/heads/main') |