-
Notifications
You must be signed in to change notification settings - Fork 2
44 lines (38 loc) · 1.54 KB
/
outpost-api-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# This action pre-builds the dev-base image and pushes it to the GitHub Container Registry (GHCR)
name: Deploy outpost api image to github container registry
on:
push:
branches: [develop, staging, production]
jobs:
push-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 "::set-output name=tag::development"
elif [[ "$BRANCH_NAME" == "staging" ]]; then
echo "::set-output name=tag::staging"
elif [[ "$BRANCH_NAME" == "production" ]]; then
echo "::set-output name=tag::latest"
fi
- name: Build and push outpost api docker image
uses: docker/build-push-action@v5
with:
context: .
tags: ghcr.io/wearefuturegov/outpost-api-service:${{ steps.vars.outputs.tag }}
file: Dockerfile.production
platforms: ${{ matrix.platforms }}
push: true
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Outpost API Service image
labels: org.opencontainers.image.source=https://github.com/wearefuturegov/outpost-api-service