name: deploy-me
on: [push]
jobs:
deploys-me:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- run: npm run dev
//Next I want to copy some file from this repo and commit to a different repo and push it
这是我的工作流程.yaml 文件,
After npm run dev
,我希望能够将文件复制到另一个目录,提交并推送到另一个存储库
name: deploy-me
'on':
- push
jobs:
deploy-me:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
env:
ACCESS_TOKEN: '${{ secrets.ACCESS_TOKEN }}'
- run: npm install
- run: npm run build
- run: |
cd lib
git config --global user.email "[email protected]"
git config --global user.name "aliasifk"
git config --global credential.helper cache
git clone https://${{secrets.ACCESS_TOKEN}}@github.com/aliasifk/xxxxxx
cp index.js clonedFolder/ -f
cd clonedFolder
git add .
git commit -m "$(date)"
git push
这就是我解决问题的方法
-
我从我的developer settings
并复制它以供后续步骤使用。
-
I added ACCESS_TOKEN
通过导航到我的存储库设置并添加秘密来更改环境变量。我在这里粘贴了之前创建的访问令牌。
-
然后简单地使用该代码并使用secrets
访问该令牌的上下文,请注意名称与我们之前创建的名称类似
- 现在只需将代码推送到存储库,一切都会像魅力一样工作:)。
黑客快乐!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)