繁体   English   中英

GitHub Actions 将更改推送到 Windows 上的远程/源

[英]GitHub Actions push changes to remote/origin on windows

我想使用 GitHub Actions 自动化我的构建过程,这个过程有以下步骤:

  1. 查看
  2. 建造
  3. 标签
  4. 增量版本
  5. 提交更改
  6. 推送标签和新提交
  7. 将包推送到仓库

我为 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 操作中将更改推送回原点/远程?

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM