bump frontend #6
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 Images Build & Push to ghrc.io | |
on: | |
push: | |
branches: [ "main" ] | |
tags: [ "v*.*.*" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the codebase | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build the Docker images and Push them to the registry-namespace indicated in REG_NS | |
run: | | |
touch .env # make sure we have one to satisfy the build | |
export REG_NS="ghcr.io/vlizbe/vocabserver-app" # sets the public scope for these, no uppercases are allowed | |
if [[ "${{ github.ref }}" == "refs/tags/v*.*.*" ]]; then | |
export BUILD_TAG=$(echo ${{ github.ref }} | sed 's|refs/tags/||') # if new tag matches pattern "v*.*.*", use the tag as Docker tag | |
else | |
export BUILD_TAG="latest" # if not a new tag, use "latest" as Docker tag | |
fi | |
docker-compose build --build-arg REG_NS=$REG_NS --build-arg BUILD_TAG=$BUILD_TAG | |
docker-compose push #$REG_NS:$BUILD_TAG |