'< /p>
Код: Выделить всё
@page "/"
@using System;
Index
Value of Secret (User) is '@myUserSecret'
Value of Secret (Machine) is '@myMachineSecret'
Value of Secret (Process) is '@myProcessSecret'
@code{
// Was set locally on computer as aaa
private string myUserSecret = Environment.GetEnvironmentVariable("MYSECRET", EnvironmentVariableTarget.User) ?? "";
// Was set locally on computer as bbb
private string myMachineSecret = Environment.GetEnvironmentVariable("MYSECRET", EnvironmentVariableTarget.Machine) ?? "";
// Was set in method OnInitialized as ccc
private string myProcessSecret = Environment.GetEnvironmentVariable("MYSECRET", EnvironmentVariableTarget.Process) ?? "";
// On GitHub, a secret with the value of ddd
protected override void OnInitialized()
{
Environment.SetEnvironmentVariable(variable: "MYSECRET", value: "ccc");
}
}
< /code>
`< /p>
name: Working with environmental variables
on:
workflow_dispatch:
env:
my_secret: ${{ secrets.MYSECRET }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Show secret
run: echo '${{ secrets.MYSECRET }}'
- name: Show secret as env variablee
run: echo '${{ env.my_secret }}'
- name: Checkout .NET
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.x'
include-preleases: false
- name: Build with .NET
run: dotnet build --configuration Release
- name: Publish
run: dotnet publish -c Release -o ${{ env.DOTNET_ROOT }}/myapp
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: .net-app
path: ${{ env.DOTNET_ROOT }}/myapp
publish:
runs-on: ubuntu-latest
needs: build
environment:
name: Production
url: ${{ steps.deploy-to-web-app.output.webapp-url }}
steps:
- name: Show url
run: echo '${{ env.url }}'
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: .net-app
- name: Deploy to Azure Web App
id: deploy-to-web-app
uses: azure/webapps-deploy@v2
with:
app-name: 'PhillipsEngineerTelirite'
slot-name: Production
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_03557B670BF14D93BD6244DC95264F2C }}
package: .
Подробнее здесь: https://stackoverflow.com/questions/770 ... arp-applic