【问题标题】:Remove a line from file with github action使用 github 操作从文件中删除一行
【发布时间】:2022-10-19 19:48:29
【问题描述】:

基本上是标题。在登台站点上开发和发布时,我的 Angular index.html 文件中有<meta name="robots" content="noindex">。现在我想要另一个动作,它会在没有那条线的情况下发布到生产中。

这似乎是一个 action 可以完成的简单任务。但是我的 google-fu 似乎让我失望了。

【问题讨论】:

    标签: github-actions


    【解决方案1】:

    弄清楚了。我只需要创建一个 shell 脚本。

    #!/bin/bash
    
    grep -v -w "noindex" ./src/index.html > tmpindex
    mv tmpindex ./src/index.html
    

    并在动作文件上

    jobs:
      build:
        runs-on: ubuntu-20.04
        steps:
          - uses: actions/checkout@v3
          - run: |
             chmod +x ./deploy.sh
             ./deploy.sh
    

    【讨论】:

      猜你喜欢
      • 2010-12-31
      • 2021-06-04
      • 2022-01-16
      • 1970-01-01
      • 1970-01-01
      • 2021-07-12
      • 2020-03-10
      • 2022-08-06
      • 1970-01-01
      相关资源
      最近更新 更多