【问题标题】:GitHub Actions push changes to remote/origin on windowsGitHub Actions 将更改推送到 Windows 上的远程/源
【发布时间】:2020-04-21 07:15:44
【问题描述】:

我想使用 GitHub Actions 自动化我的构建过程,该过程包含以下步骤:

  1. 结帐
  2. 构建
  3. 打包
  4. 标签
  5. 增量版本
  6. 提交更改
  7. 推送标签和新提交
  8. 将包推送到仓库

我为 GitHub Actions 创建了这个 main.yml:

name: Build

on:
  repository_dispatch:
    types: build

jobs:
  build:
    name: Run build
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v1
        with:
          ref: 'master'
          token: ${{ secrets.GITHUB_TOKEN }}

      # checkout master, 'cause of detached head
      - name: Checkout master
        run: git checkout master

      # run the build script
      - name: Build
        if: success()
        run: .\build\build.ps1

      # pack everything
      - name: Pack
        if: success()
        run: .\build\pack.ps1

      # tag this version
      - name: Tag
        if: success()
        run: .\build\tag.ps1

      # increment version
      - name: Increment Version
        if: success()
        run: .\build\increment-version.ps1

      # Commit changes
      - name: Add & Commit
        if: success()
        run: |
          git config user.email actions@github.com
          git config user.name "GitHub Actions"
          git commit -a -m "Automated build" --author="GitHub Actions<actions@github.com>"

      # todo: push changes to remote/origin
      - name: Git Push
        if: success()
        run: git push

      # Push package to a repo
      - name: Push Package
        if: success()
        run: .\build\push-package.ps1

我尝试使用市场提供的操作,但遗憾的是我必须在 Windows 机器上构建此应用程序。
大多数操作退出并显示以下错误消息:##[error]Container action is only supported on Linux.
另一个也不好用,这就是我尝试使用run 选项的原因。

不幸的是,使用这种方式推送也不起作用。我得到这个输出:

Logon failed, use ctrl+c to cancel basic credential prompt.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)

(我必须手动取消任务。)

我想我必须向 push 命令提供{{ secrets.GITHUB_TOKEN }},但我只找到了一种使用基本身份验证的方法,但我发现所有指南(一般指南)都使用此令牌作为不记名令牌。

如何在 Windows 上的 GitHub Actions 中将更改推送回源/远程?

【问题讨论】:

标签: windows git git-push github-actions


【解决方案1】:

使用GitHub Push by ad-m 解决了我的问题。我很确定我已经测试过这个动作。

【讨论】:

    猜你喜欢
    • 2020-06-15
    • 1970-01-01
    • 2018-10-10
    • 1970-01-01
    • 1970-01-01
    • 2011-06-09
    • 1970-01-01
    • 1970-01-01
    • 2020-12-18
    相关资源
    最近更新 更多