Skip to content

Merge pull request #68 from wearefuturegov/TOP-251-meta-filter #37

Merge pull request #68 from wearefuturegov/TOP-251-meta-filter

Merge pull request #68 from wearefuturegov/TOP-251-meta-filter #37

# This action pre-builds the dev-base image and pushes it to the GitHub Container Registry (GHCR)
name: Publish outpost-api-service to github container registry
on:
push:
branches: [develop, staging, production]
jobs:
publish-outpost-api-image:
runs-on: ubuntu-latest
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@main
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Set Docker Image Tag
id: vars
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
if [[ "$BRANCH_NAME" == "develop" ]]; then
echo "tag=development" >> $GITHUB_ENV
elif [[ "$BRANCH_NAME" == "staging" ]]; then
echo "tag=staging" >> $GITHUB_ENV
elif [[ "$BRANCH_NAME" == "production" ]]; then
echo "tag=latest" >> $GITHUB_ENV
else
echo "tag=default" >> $GITHUB_ENV
fi
- name: Build and push outpost api docker image
uses: docker/build-push-action@v5
with:
context: .
tags: ghcr.io/wearefuturegov/outpost-api-service:${{ env.tag }}
file: Dockerfile.production
push: true
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Outpost API Service image,oci-mediatypes=false
labels: org.opencontainers.image.source=https://github.com/wearefuturegov/outpost-api-service