Skip to content

Merge branch 'staging' into prod #45

Merge branch 'staging' into prod

Merge branch 'staging' into prod #45

### Set Up by: Christian Garcia (TACC) (Originally for Pods Service)
### Release-* methodology originally authored by Nathan Freeman (TACC) here:
### https://github.com/tapis-project/tapis-workflows/blob/prod/.github/workflows/ci.yml#L59
# Description. This Github action runs when there are new commits to dev, stage, or release-*.
# The action logs into Docker with the Github action environment secrets `DOCKERHUB_USERNAME`
# and `DOCKERHUB_TOKEN`.
# The action pulls the repo and builds the tapis/pgrest-api image and uses branch name as the
# docker tag. In instance of `release-1.2.0`, sed will delete `release-`, leaving `1.2.0`.
# If branch = prod, tag becomes `latest` so latest is built.
#
# NOVEMBER 29th:
# DOCKERHUB_USERNAME: username for cgarcia
# DOCKERHUB_TOKEN: token for cgarcia
name: Build & Push - All Branches
on:
push:
branches: [ dev, staging, prod, release-* ]
pull_request:
branches: [ dev, staging, prod, release-* ]
workflow_dispatch:
environment: docker
jobs:
build-and-push-images:
runs-on: ubuntu-latest
environment: docker
steps:
- name: Get tag name from branch. SED removes `release-`, replaces `prod` with `latest`.
id: get_tag_name
shell: bash
run: echo "tag_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/prod/latest/g' | sed 's/release-//g')" >> $GITHUB_OUTPUT
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & push tagged Docker backend image
uses: docker/build-push-action@v3
with:
push: true
tags: tapis/pgrest-api:${{ steps.get_tag_name.outputs.tag_name }}