-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): workflow definition created
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
paths: | ||
- src/** | ||
- .github/workflows/ci.yml | ||
branches: | ||
- master | ||
tags: | ||
- v*-proxy | ||
|
||
env: | ||
DOTNET_VERSION: 6.0.x | ||
DOTNET_SOLUTION: WOZ.sln | ||
NODE_VERSION: 18 | ||
CONTAINER_NAME: ghcr.io/vng-realisatie/wozbevragenproxy | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
- name: Restore dependencies | ||
run: dotnet restore ${{ env.DOTNET_SOLUTION }} | ||
- name: Build | ||
run: dotnet build ${{ env.DOTNET_SOLUTION }} --configuration Release --no-restore | ||
- name: Test | ||
run: dotnet test ${{ env.DOTNET_SOLUTION }} --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage | ||
publish: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Cache container images | ||
uses: actions/[email protected] | ||
with: | ||
path: /var/lib/docker/ | ||
key: local-docker-directory | ||
- name: Build container images | ||
run: docker compose build | ||
- uses: actions-ecosystem/action-regex-match@v2 | ||
if: always() | ||
id: regex-match | ||
with: | ||
text: ${{ github.ref_name }} | ||
regex: '^v(.*)-(.*)$' | ||
- name: Login to GitHub Container Registry | ||
if: always() && steps.regex-match.outputs.match != '' | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: push proxy container images | ||
if: always() && steps.regex-match.outputs.group2 == 'proxy' | ||
run: | | ||
docker tag ${{ env.CONTAINER_NAME }}-proxy:latest ${{ env.CONTAINER_NAME }}-proxy:${{ steps.regex-match.outputs.group1 }} | ||
docker push ${{ env.CONTAINER_NAME }}-proxy:latest | ||
docker push ${{ env.CONTAINER_NAME }}-proxy:${{ steps.regex-match.outputs.group1 }} |