Last active
May 20, 2020 14:28
-
-
Save calvinchengx/d91245d65fd8ed424203d5d725946a95 to your computer and use it in GitHub Desktop.
direct deployment to git repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
machine: true | |
steps: | |
- run: | |
name: Clone repo | |
working_directory: ~/workdir | |
command: | | |
git clone --depth 1 https://${REPO_GITHUB_TOKEN}@github.com/namespace/repo.git | |
- deploy: | |
name: Trigger repo deployment | |
working_directory: ~/workdir/repo | |
command: | | |
git config credential.helper 'cache --timeout=120' | |
git config user.email "<email>" | |
git config user.name "Deployment Bot" | |
git commit --allow-empty -m "Trigger deployment" | |
# Push quietly to prevent showing the token in log | |
git push -q https://${REPO_GITHUB_TOKEN}@github.com/namespace/repo.git master | |
# The git clone is first. | |
# All subsequent git commands have to be executed in the clone directory. working_directory simplifies this a great deal. | |
# The token REPO_GITHUB_TOKEN is a personal access token with repo scope for the target repository. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment