Skip to content

Commit

Permalink
Update dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelschlatter authored Nov 3, 2023
1 parent 47861cd commit c7ed4f9
Showing 1 changed file with 11 additions and 71 deletions.
82 changes: 11 additions & 71 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
name: .NET

env:
PRERELEASE_BRANCHES: experimental,alpha,beta,rc
DOCKER_HUB_REPO: ${{ secrets.RAAEDGE_LOGIN_SERVER }}/connectors-opcua
COVERAGE_FOLDER: Coverage
name: 'dotnet build'

on:
push:
Expand All @@ -13,68 +8,13 @@ on:
types: [ closed ]

jobs:
ci:
name: Integration
runs-on: ubuntu-latest
outputs:
should-publish: ${{ steps.context.outputs.should-publish }}
current-version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}
cascading-release: ${{ steps.context.outputs.cascading-release }}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Install dependencies
run: dotnet restore --no-cache --verbosity normal
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --configuration Release --no-build

- name: 'Azure login'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.RAAEDGE_LOGIN_SERVER }}
username: ${{ secrets.RAAEDGE_ACR_USERNAME }}
password: ${{ secrets.RAAEDGE_ACR_PASSWORD }}

- name: Establish context
id: context
uses: dolittle/establish-context-action@v2
with:
prerelease-branches: ${{ env.PRERELEASE_BRANCHES }}

- name: Docker Build
if: ${{ steps.context.outputs.should-publish == 'false' }}
shell: bash
run: |
docker build --no-cache -f $GITHUB_WORKSPACE/Source/Dockerfile -t ${{ env.DOCKER_HUB_REPO }}:${{ github.sha }} .
- name: Increment version
id: increment-version
if: ${{ steps.context.outputs.should-publish == 'true' }}
uses: dolittle/increment-version-action@v2
with:
version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}

- name: Docker push
if: ${{ steps.context.outputs.should-publish == 'true' && env.DOCKER_HUB_REPO != '' }}
run: |
docker build --no-cache -f $GITHUB_WORKSPACE/Source/Dockerfile -t ${{ env.DOCKER_HUB_REPO }}:${{ steps.increment-version.outputs.next-version }} -t ${{ env.DOCKER_HUB_REPO }}:latest .
docker push ${{ env.DOCKER_HUB_REPO }}:${{ steps.increment-version.outputs.next-version }}
docker push ${{ env.DOCKER_HUB_REPO }}:latest
- name: Create GitHub Release
uses: dolittle/github-release-action@v2
if: ${{ steps.context.outputs.should-publish == 'true' }}
with:
cascading-release: ${{ steps.context.outputs.cascading-release }}
version: ${{ steps.increment-version.outputs.next-version }}
body: ${{ steps.context.outputs.pr-body }}
dotnet:
uses: RaaLabs/reusable-workflows/.github/workflows/dotnet-build.yml@main
with:
IMAGE_NAME: 'connectors-opcua'
secrets:
DOCKER_REGISTRY_LOGIN_SERVER: ${{ secrets.RAAEDGE_LOGIN_SERVER }}
DOCKER_REGISTRY_USERNAME: ${{ secrets.RAAEDGE_ACR_USERNAME }}
DOCKER_REGISTRY_PASSWORD: ${{ secrets.RAAEDGE_ACR_PASSWORD }}
NUGET_GITHUB_PACKAGES_TOKEN: ${{ secrets.NUGET_GITHUB_PACKAGES_TOKEN }}
NUGET_GITHUB_PACKAGES_USERNAME: ${{ secrets.NUGET_GITHUB_PACKAGES_USERNAME }}

0 comments on commit c7ed4f9

Please sign in to comment.