有一个自有的私密仓库,我不想让别人看到源代码,只是想把产物展示出来。从而想到用 GitHub Action 的 CI/CD 持续集成,将产物自动推动到另一个仓库。
编写代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| name: Deploy to GitHub Pages on: push: branches: - master jobs: deploy: name: Deploy to GitHub Pages runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: Use Node.js uses: actions/setup-node@v1 with: node-version: 10.x - name: npm install and build run: | npm install npm run build
- name: Deploy uses: s0/git-publish-subdir-action@develop env: REPO: [email protected]:owner/repo.git BRANCH: gh-pages FOLDER: build SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_PRIVATE_KEY }}
|
参考文献
《 git-publish-subdir-action 》 - GitHub
GitHub Action 将构建产物自动推送到另一个仓库