rel*_*lef 3 emscripten github-pages github-actions
我想创建一个 GitHub 工作流,使用 emscripten 和 cmake 构建 C++ 应用程序,并将其部署到 GitHub Pages。我的工作流程工作如下所示。
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
runs-on: ubuntu-latest
container:
image: emscripten/emsdk
steps:
- uses: actions/checkout@v3
- run: cmake -B $GITHUB_WORKSPACE/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEMSCRIPTEN=ON
- run: cmake --build $GITHUB_WORKSPACE/build --config ${{env.BUILD_TYPE}}
# actions/upload-pages-artifact uses this directory, but it doesn't exist in the image
- run: mkdir -p ${{runner.temp}}
- uses: actions/configure-pages@v1
- uses: actions/upload-pages-artifact@v1
with:
path: $GITHUB_WORKSPACE/build
- id: deployment
uses: actions/deploy-pages@v1
Run Code Online (Sandbox Code Playgroud)
upload-pages-artifact运行 tar 并在日志中列出要部署的所有文件。运行时upload-artifact日志显示Warning: No files were found with the provided path: /__w/_temp/artifact.tar. No artifacts will be uploaded..
upload-artifact请注意,警告中的路径与( )的参数提供的路径不同path: /home/runner/work/_temp/artifact.tar。
upload-pages-artifact在没有 emscripten 容器的情况下运行时可以按预期工作。
我必须要么upload-pages-artifact在容器内工作,要么以某种方式与容器外运行的第二个作业共享构建。
将工作分为两项工作,一项用于构建,一项用于部署。使用actions/upload-artifact和actions/download-artifact将构建从一个作业传递到下一个作业。不要使用$GITHUB_WORKSPACE,因为它可能未指向图像中的正确目录。
jobs:
build:
runs-on: ubuntu-latest
container:
image: emscripten/emsdk
steps:
- uses: actions/checkout@v3
- run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEMSCRIPTEN=ON
- run: cmake --build build --config ${{env.BUILD_TYPE}}
- uses: actions/upload-artifact@master
with:
name: page
path: build
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
steps:
- uses: actions/download-artifact@master
with:
name: page
path: .
- uses: actions/configure-pages@v1
- uses: actions/upload-pages-artifact@v1
with:
path: .
- id: deployment
uses: actions/deploy-pages@main
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4995 次 |
| 最近记录: |