在无服务器部署上调用github工作流

我有一个我尝试部署的带有aws lambda的无服务器nodejs项目。在部署之前,我想解密某些文件,然后触发实际部署

这是我 .github / workflows 目录中的 main.yml 文件的内容

name: Test

on: [deployment]

jobs:
  build:

    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@test
    - name: Decrypting files
      run: <decrypt commands here>
    - name: actual Serverless Deployment
      run: sls deploy -s staging

如果我执行sls部署,则不会被调用。我很感兴趣,如果我触发 sls deploy 命令,github将如何知道它是一个部署事件。请帮助我了解上述部署事件的确切触发时间。 我要实现的目标是启动部署命令(即 sls deploy -s staging 等),并调用上述工作流程->(action1)解密文件->(action2)触发实际部署到lambda

PS:确切的事情是在git push上工作正常,但我不希望它在每次推送回购时都部署。

请帮助我理解这一点。我对github工作流程非常陌生。

benxiaolai 回答:在无服务器部署上调用github工作流

deployment事件在部署开始,完成等时发生。 您可以使用Github Api创建部署:POST /repos/:owner/:repo/deployments(此处有更多详细信息:https://developer.github.com/v3/repos/deployments/#create-a-deployment

或者,您可以使用

on:
  push:
    branches:
    - master

仅在将某些内容合并到主文件后运行您的工作流。

本文链接:https://www.f2er.com/3100847.html

大家都在问