forked from bcgov/sheriff-scheduling
-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (53 loc) · 2.14 KB
/
api-buildandpush.yaml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Build & Push API Image to Artifactory
on:
push:
branches: [main]
paths:
- "api"
- ".github/workflows/api-buildandpush.yaml"
workflow_dispatch:
env:
IMAGE_NAME: cas-api
WORKING_DIRECTORY: ./
jobs:
builds:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to Artifactory
# if: github.repository_owner == 'bcgov-c'
uses: docker/login-action@v1
with:
registry: artifacts.developer.gov.bc.ca
username: ${{ secrets.CAS_ARTIFACTORY_USERNAME }}
password: ${{ secrets.CAS_ARTIFACTORY_PASSWORD }}
# Get SHORT_SHA to tag images
- name: Get short SHA
id: short_sha
run: |
echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)"
echo "Short SHA: $SHORT_SHA"
# - name: Install dependencies
# run: dotnet restore
# working-directory: ${{env.WORKING_DIRECTORY}}
# - name: Build
# run: dotnet build --configuration Release --no-restore
# working-directory: ${{env.WORKING_DIRECTORY}}
# - name: Test
# run: dotnet test --no-restore --verbosity normal
# working-directory: ${{env.WORKING_DIRECTORY}}
# - name: Push to Artifactory
# id: publish
# run: dotnet push artifacts.developer.gov.bc.ca/cac1-cas-api/${{ env.IMAGE_NAME }}:dev-${{ steps.short_sha.outputs.SHORT_SHA }}
- name: Docker Build Backend Image
working-directory: ${{env.WORKING_DIRECTORY}}
run: |
docker build --tag api . --file api/Dockerfile
docker tag api artifacts.developer.gov.bc.ca/cac1-cas/${{ env.IMAGE_NAME }}:dev-${{ steps.short_sha.outputs.SHORT_SHA }}
# docker compose build backend
# docker tag cas-api artifacts.developer.gov.bc.ca/cac1-cas/${{ env.IMAGE_NAME }}:dev-${{ steps.short_sha.outputs.SHORT_SHA }}
- name: Docker Push to Artifactory
id: publish
# if: github.repository_owner == 'bcgov-c'
run: |
docker push artifacts.developer.gov.bc.ca/cac1-cas/${{ env.IMAGE_NAME }}:dev-${{ steps.short_sha.outputs.SHORT_SHA }}