簡體   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