Merge pull request #108 from bcgov/openshift-helm-config #35
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: CI-ClaimsService | |
on: | |
push: | |
branches: | |
- "main" | |
paths: | |
- 'Services/ClaimService/**' | |
pull_request: | |
branches: | |
- "main" | |
paths: | |
- 'Services/ClaimService/**' | |
workflow_dispatch: | |
env: | |
APP: ClaimService | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout source" | |
uses: actions/checkout@v3 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v2.1.0 | |
- name: Building ${{ env.APP }} | |
run: | | |
buildid=$(date +"%Y%m%d").$GITHUB_RUN_ID.$GITHUB_RUN_NUMBER.$GITHUB_RUN_ATTEMPT | |
echo Starting C# Build as $buildid | |
dotnet publish $GITHUB_WORKSPACE/Services/$APP/src/$APP.csproj -o $RUNNER_TEMP -c Release | |
echo Starting Docker Build | |
imageName=${{ secrets.SILVER_IMAGE_REPOSITORY }}/${{ secrets.SILVER_TOOLS_NAMESPACE }}/$(echo $APP | tr '[:upper:]' '[:lower:]') | |
docker build -f $GITHUB_WORKSPACE/Services/$APP/src/Dockerfile $RUNNER_TEMP -t $imageName:dev | |
- name: OpenShift Silver Login | |
uses: redhat-actions/oc-login@v1.1 | |
with: | |
openshift_server_url: ${{ secrets.SILVER_URI }} | |
openshift_token: ${{ secrets.SILVER_TOKEN }} | |
namespace: ${{ secrets.SILVER_TOOLS_NAMSPACE }} | |
- name: Pushing ${{ env.APP }} to Silver | |
run: | | |
imageName=${{ secrets.SILVER_IMAGE_REPOSITORY }}/${{ secrets.SILVER_TOOLS_NAMESPACE }}/$(echo $APP | tr '[:upper:]' '[:lower:]') | |
docker login -u ${{ secrets.OPENSHIFT_USER }} -p `oc whoami --show-token` ${{ secrets.SILVER_IMAGE_REPOSITORY }} | |
docker push $imageName:dev |