Skip to content

Commit

Permalink
WIP setup SSH deploy keys
Browse files Browse the repository at this point in the history
  • Loading branch information
nodiscc committed Jul 24, 2023
1 parent b388a9c commit 1ff4c70
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

# This job requires deploy keys to be added to target repositories (https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys)
# Generate deploy keys locally:
# $ ssh-keygen -t rsa -f awesome-selfhosted-deploy-key -C awesome-selfhosted-deploy-key
# $ ssh-keygen -t rsa -f awesome-selfhosted-html-deploy-key -C awesome-selfhosted-html-deploy-key
# Paste the contents of awesome-selfhosted-deploy-key.pub to https://github.com/nodiscc/awesome-selfhosted/settings/keys/new, name: awesome-selfhosted-deploy-key, allow write access
# Paste the contents of awesome-selfhosted-html-deploy-key.pub to https://github.com/nodiscc/awesome-selfhosted-html-preview/settings/keys/new, name: awesome-selfhosted-html-deploy-key
# Access https://github.com/awesome-selfhosted/awesome-selfhosted-data/settings/environments, create new environment with name: production
# - deployment branches: selected branches
# - add deployment branch rule: branch name pattern: master
# - environment secrets: add secret with name: SSH_DEPLOY_KEY, and value: paste the contents of awesome-selfhosted-deploy-key
# - environment secrets: add secret with name: SSH_HTML_DEPLOY_KEY, and value: paste the contents of awesome-selfhosted-html-deploy-key

jobs:
build:
environment: production
Expand All @@ -19,7 +31,7 @@ jobs:
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_DEPLOY_KEY }}" > ~/.ssh/id_rsa
echo "${{ secrets.SSH_DEPLOY_KEY }}" > ~/.ssh/id_rsa_html
echo "${{ secrets.SSH_HTML_DEPLOY_KEY }}" > ~/.ssh/id_rsa_html
chmod 0600 ~/.ssh/id_rsa ~/.ssh/id_rsa_html
eval $(ssh-agent)
ssh-add ~/.ssh/id_rsa
Expand Down

0 comments on commit 1ff4c70

Please sign in to comment.