Up #24
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: .NET | |
on: | |
push: | |
branches: ["main", "dev"] | |
pull_request: | |
branches: ["main", "dev"] | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
# Extracting branch name for Windows | |
- name: Extract branch name (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
$branchName = $env:GITHUB_REF -replace "refs/heads/", "" | |
echo "BRANCH_NAME=$branchName" | Out-File -Append $env:GITHUB_ENV | |
# Extracting branch name for Linux/macOS | |
- name: Extract branch name (Linux/macOS) | |
if: runner.os != 'Windows' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | |
# Modifying paths to include branch name | |
- name: Set up .env | |
run: cp ../${BRANCH_NAME}/ethtps_files/.env ./.env | |
- name: Set up appsttings.json | |
run: cp ../${BRANCH_NAME}/ethtps_files/appsettings.json ./ETHTPS.API/appsettings.json | |
- name: Set up docker-compose.yml | |
run: cp ../${BRANCH_NAME}/ethtps_files/docker-compose.yml ./docker-compose.yml | |
- name: Set up StartupConfig.json | |
run: cp ../${BRANCH_NAME}/ethtps_files/StartupConfig.json ./ETHTPS.Configuration/StartupConfig.json | |
- uses: actions/checkout@v3 | |
# Assuming .NET is already installed | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore |