Created
July 23, 2022 09:34
-
-
Save UtsavChokshiCNU/6d46c3cadeeea56f1326fc81d15b4007 to your computer and use it in GitHub Desktop.
Setup CI/CD on github repo using EYK (EngineYard Kontainers). Put this file under `.github/workflows` on github
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
name: deploy-to-eyk | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
# Environment variables available to all jobs and steps in this workflow | |
env: | |
SSH_KEY: ${{secrets.EYK_STAGING_PRIVATE_KEY}} | |
EYK_HOST: ${{secrets.EYK_SSH_HOST}} | |
EYK_APP_NAME: api-backend | |
jobs: | |
# This workflow contains a single job called "deploy" | |
deploy: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout repository code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
# If you have setup eyk successfully on local machine | |
# Then run -> `git remote show eyk` to get values of EYK_HOST and EYK_APP_NAME | |
- name: Add EYK remote | |
run: git remote add eyk "ssh://git@$EYK_HOST:2222/$EYK_APP_NAME.git" | |
- name: Save secrets key and host | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/eyk_rsa | |
chmod 600 ~/eyk_rsa | |
ssh-keyscan -p 2222 -H "$EYK_HOST" >> ~/.ssh/known_hosts | |
- name: Push to EYK | |
run: | | |
export GIT_SSH_COMMAND="ssh -i ~/eyk_rsa" | |
git push eyk --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment