Skip to content

.NET 8 upgrade

.NET 8 upgrade #24

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
env:
VERSION_NUMBER: "8.0"
PR_NUMBER: ${{ github.event.number }}
services:
postgres:
image: postgres
env:
POSTGRES_DB: letmein
POSTGRES_USER: letmein
POSTGRES_PASSWORD: letmein123
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update csproj version number
run: |
sed "s|<Version>99.88.77</Version>|<Version>$VERSION_NUMBER.$GITHUB_RUN_NUMBER</Version>|" src/Letmein.Web/Letmein.Web.csproj > src/Letmein.Web/Letmein.Web.csproj.temp
mv src/Letmein.Web/Letmein.Web.csproj.temp src/Letmein.Web/Letmein.Web.csproj
cat src/Letmein.Web/Letmein.Web.csproj
- name: Setup Node
uses: actions/setup-node@v4
- name: Node install and run
run: |
pushd src/Letmein.Web/wwwroot
npm config set registry http://registry.npmjs.org/
npm install
./node_modules/.bin/gulp --docker_tag $VERSION_NUMBER.$GITHUB_RUN_NUMBER
popd
- name: Clean wwwroot
run: |
rm -rf ./src/Letmein.Web/wwwroot/js/libraries
rm ./src/Letmein.Web/wwwroot/js/letmein.js
rm ./src/Letmein.Web/wwwroot/_references.js
rm ./src/Letmein.Web/wwwroot/package.json
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Docker login
uses: docker/login-action@v3
with:
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
# See: https://github.com/dotnet/sdk-container-builds/blob/main/docs/RegistryAuthentication.md
- name: Publish Docker container
id: publish-container
shell: pwsh
env:
ContainerImageName: anotherchris/letmein
ContainerRegistry: docker.io
ContainerRepository: letmein
run: |
dotnet publish ./src/Letmein.Web/Letmein.Web.csproj --arch x64 --os linux -p:PublishProfile=DefaultContainer