fix: sed delimiters #16
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: WebIO build and publish | |
on: | |
push: | |
branches: [ "main", "beta" ] | |
pull_request: | |
branches: [ "main", "beta" ] | |
jobs: | |
build-frontend: | |
defaults: | |
run: | |
working-directory: ./webclient | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.17.0' | |
- name: Install dependencies | |
run: npm ci | |
- name: Swagger | |
run: npm run swagger | |
- name: put secrets in prod environment file | |
shell: bash | |
env: | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
run: |- | |
sed -i "s@#AZURE_CLIENT_ID#@${{ secrets.AZURE_CLIENT_ID }}@g" ./src/environments/environment.prod.ts | |
sed -i "s@#AZURE_TENANT_ID#@${{ secrets.AZURE_TENANT_ID }}@g" ./src/environments/environment.prod.ts | |
- name: Build | |
run: npm run build-prod | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WebIO.Frontend | |
path: ./webclient/dist/metechno-io-db | |
build-and-test-backend: | |
defaults: | |
run: | |
working-directory: ./src/WebIO | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: getong/[email protected] | |
with: | |
elasticsearch version: '8.10.2' | |
host port: 9200 | |
container port: 9200 | |
host node port: 9300 | |
node port: 9300 | |
discovery type: 'single-node' | |
- uses: potatoqualitee/[email protected] | |
with: | |
install: sqlengine | |
version: 2022 | |
sa-password: BVkMcwpF57vCCGQN7Pbr | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test --no-build --verbosity normal | |
publish-cli: | |
defaults: | |
run: | |
working-directory: ./src/WebIO | |
runs-on: ubuntu-latest | |
needs: build-and-test-backend | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Publish | |
run: dotnet publish -c Release -r win-x64 WebIO.Cli/WebIO.Cli.csproj | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WebIO.Cli | |
path: ./src/WebIO/WebIO.Cli/bin/Release/net7.0/win-x64/publish | |
publish-api: | |
defaults: | |
run: | |
working-directory: ./src/WebIO | |
runs-on: ubuntu-latest | |
needs: build-and-test-backend | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Publish | |
run: dotnet publish -c Release WebIO.Api/WebIO.Api.csproj | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WebIO.Api | |
path: ./src/WebIO/WebIO.Api/bin/Release/net7.0/publish | |
publish-docker: | |
runs-on: ubuntu-latest | |
needs: | |
- publish-api | |
- build-frontend | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download API | |
uses: actions/download-artifact@v3 | |
with: | |
name: WebIO.Api | |
path: build/app | |
- name: List API files | |
run: ls -la build/app | |
- name: Download Frontend | |
uses: actions/download-artifact@v3 | |
with: | |
name: WebIO.Frontend | |
path: build/wwwroot | |
- name: List Frontend files | |
run: ls -la build/wwwroot | |
- name: Configure secrets | |
shell: bash | |
env: | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
AZURE_AUDIENCE: ${{ secrets.AZURE_AUDIENCE }} | |
AZURE_INSTANCE: ${{ env.AZURE_INSTANCE }} | |
run: | | |
sed -i "s@#AZURE_CLIENT_ID#@${{ secrets.AZURE_CLIENT_ID }}@g" ./build/app/appsettings.Production.json | |
sed -i "s@#AZURE_TENANT_ID#@${{ secrets.AZURE_TENANT_ID }}@g" ./build/app/appsettings.Production.json | |
sed -i "s@#AZURE_AUDIENCE#@${{ secrets.AZURE_AUDIENCE }}@g" ./build/app/appsettings.Production.json | |
sed -i "s@#AZURE_INSTANCE#@${{ env.AZURE_INSTANCE }}@g" ./build/app/appsettings.Production.json | |
- name: Docker build | |
run: | | |
cd build | |
docker build -t webio:latest -t webio:${{ github.run_id }} . | |
docker save webio:latest --output ./webio-latest.tar | |
docker save webio:${{ github.run_id }} --output ./webio-${{ github.run_id }}.tar | |
- name: Upload latest | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WebIO.Docker-latest | |
path: ./build/webio-latest.tar | |
- name: Upload run-id version | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WebIO.Docker-${{ github.run_id }} | |
path: ./build/webio-${{ github.run_id }}.tar |