Merge pull request #717 from bcgov/BCPPSDEMS-2131-disc-merges #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: diam-common-constants | |
on: | |
push: | |
branches: [develop] | |
paths: | |
- "backend/CommonConstants/**" | |
- ".github/workflows/build-push-commonconstants.yml" | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: common | |
WORKING_DIRECTORY: ./backend/CommonConstants | |
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 | |
working-directory: ${{env.WORKING_DIRECTORY}} | |
run: | | |
dotnet build -c Release | |
dotnet pack -c Release | |
ls -lstra | |
- name: Docker Push to Artifactory | |
working-directory: backend/CommonConstants/bin/Release | |
run: | | |
nuget push *.nupkg -Source https://artifacts.developer.gov.bc.ca/artifactory/api/nuget/de27-common -apikey ${{ secrets.ARTIFACTORY_USERNAME }}:${{ secrets.ARTIFACTORY_PASSWORD }} |