Skip to content

dotnet

dotnet #2

name: diam-common
on:
push:
branches: [jess-admin-tool]
paths:
- "backend/common/**"
- ".github/workflows/build-push-common.yml"
workflow_dispatch:
env:
IMAGE_NAME: common
WORKING_DIRECTORY: ./backend
BRANCH_NAME: develop
VALUES_FILE: dev
jobs:
build:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Set environment for branch
run: |
if [[ ${{ github.ref_name }} == 'main' ]]; then
echo "BRANCH_NAME=main" >> "$GITHUB_ENV"
echo "VALUES_FILE=prod" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'test' ]]; then
echo "BRANCH_NAME=test" >> "$GITHUB_ENV"
echo "VALUES_FILE=test" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'develop' ]]; then
echo "BRANCH_NAME=develop" >> "$GITHUB_ENV"
echo "VALUES_FILE=dev" >> "$GITHUB_ENV"
fi
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
- name: Login to Artifactory
uses: docker/login-action@v1
with:
registry: artifacts.developer.gov.bc.ca
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Dotnet Pack
run: |
dotnet pack -c Release
#- name: Docker Push to Artifactory
# run: |
# docker push artifacts.developer.gov.bc.ca/de27-common/${{env.IMAGE_NAME}}:${GITHUB_REF##*/}