获取要传递到下一步的部署url-带有Github操作的Azure静态Web应用程序



我正在使用带有Github操作的Azure静态web应用程序,我需要将部署URL传递到下一步。

知道我怎么才能拿到它吗?步骤获取部署URL失败,环境为null错误。这是我的yml文件。

name: Azure Static Web Apps CI/CD
on:
push:
branches:
- dev
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- dev
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_HAPPY_RIVER_01F5A930F }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: "" # Api source code path - optional
output_location: "build" # Built app content directory - optional
env:
VITE_AG_GRID_LICENSE_KEY: ${{secrets.VITE_AG_GRID_LICENSE_KEY}}
VITE_API_SCOPE: ${{secrets.VITE_API_SCOPE}}
VITE_CLIENT_ID: ${{secrets.VITE_CLIENT_ID}}
VITE_SOURCE_LOADER_BASE_URL: ${{secrets.VITE_SOURCE_LOADER_BASE_URL_DEV}}
VITE_TENANT_ID: ${{secrets.VITE_TENANT_ID}}
- name: Get deployment URL
id: deployment
uses: dorshinar/get-deployment-url@master
timeout-minutes: 5
with:
token: ${{ secrets.GITHUB_TOKEN }}
- run: echo ${{ steps.deployment.outputs.deployment }}
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_HAPPY_RIVER_01F5A930F }}
action: "close"

您应该能够从Azure/static-web-apps-deploy:获得URL作为输出参数

...
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
...
- name: Print Deployment URL
run: echo ${{ steps.builddeploy.outputs.static_web_app_url }}

这里有一个定义动作yml的链接。

在我的例子中,它给出了一个空字符串,如下所示。

Environment URL '' is not a valid http(s) URL, so it will not be shown as a link in the workflow graph.

我通过重新启动Azure AppService解决了这个问题。

请务必检查失败的生成步骤,因为此错误也可能指示错误。

最新更新