-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add push to another repository workflow #7
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,19 @@ | ||||||
# Push to another repository | ||||||
|
||||||
## The problem | ||||||
Sometimes we need push code from `Repository A` | ||||||
action to `Repository B` codebase, for eg. when we are implementing | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it should be |
||||||
GitOps(for the deployment repo) or when we need separate repo for build | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
process for eg. with Design Tokens. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here "e.g. / for example" |
||||||
|
||||||
## Solution | ||||||
We can leverage GitHub deploy keys(https://docs.github.com/en/developers/overview/managing-deploy-keys), heres how: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
1) Follow the steps in the official guide. | ||||||
2) In step 4 add key to our destination(`Repository B`) repo. | ||||||
3) In step 7 check `Allow write access`. | ||||||
4) Go to source repo(`Repository A`). | ||||||
5) Go to `Settings` > `Secrets` > `Actions`. | ||||||
6) Click `New repository secret`. | ||||||
7) Add name for eg. `DEPLOY_SSH_KEY` - remember it must match variable name used in workflow. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
8) As content paste your private key `.pem`. | ||||||
9) Add push step form `push-to-another-repo.yml` file to your workflow. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Deploy | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
deploy-to-separate-repo: | ||
name: Commit and push | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: 'Selleo/dev-templates' # Put your repo here | ||
ref: 'master' | ||
ssh-key: ${{ secrets.DEPLOY_SSH_KEY }} # Ensure that it matches your secret | ||
- name: Push | ||
run: |- | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add your_changes.txt # Add files that you want to push | ||
git commit -m "Deploy" # Customize your commit message | ||
git push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.