From 757dfa01de5247ff3ae8e1cc8e9a96f61ffdc3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 6 Nov 2023 22:36:52 +0100 Subject: [PATCH] deployment --- .github/workflows/deploy-obrok-dev.yml | 74 ++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/deploy-obrok-dev.yml diff --git a/.github/workflows/deploy-obrok-dev.yml b/.github/workflows/deploy-obrok-dev.yml new file mode 100644 index 000000000..d94aa0ab7 --- /dev/null +++ b/.github/workflows/deploy-obrok-dev.yml @@ -0,0 +1,74 @@ +name: deploy-obrok-dev + +on: + push: + branches: [obrok/master] + +concurrency: + group: environment-dev + +jobs: + deploy: + name: "Deploy to srs-obrok.skauting.cz" + environment: srs-obrok.skauting.cz + runs-on: ubuntu-22.04 + container: + image: skaut/lebeda:8.1 + env: + CONFIG_DATABASE_HOST: ${{ secrets.CONFIG_DATABASE_HOST }} + CONFIG_DATABASE_NAME: ${{ secrets.CONFIG_DATABASE_NAME }} + CONFIG_DATABASE_PASSWORD: ${{ secrets.CONFIG_DATABASE_PASSWORD }} + CONFIG_DATABASE_USER: ${{ secrets.CONFIG_DATABASE_USER }} + CONFIG_MAIL_HOST: + CONFIG_MAIL_PASSWORD: + CONFIG_MAIL_PORT: 0 + CONFIG_MAIL_SECURE: + CONFIG_MAIL_SMTP: false + CONFIG_MAIL_USERNAME: + CONFIG_MAILING_SENDER_EMAIL: ${{ secrets.CONFIG_MAILING_SENDER_EMAIL }} + CONFIG_SKAUTIS_APPLICATION_ID: ${{ secrets.CONFIG_SKAUTIS_APPLICATION_ID }} + CONFIG_SKAUTIS_TEST_MODE: ${{ secrets.CONFIG_SKAUTIS_TEST_MODE }} + CONFIG_RECAPTCHA_SITE_KEY: ${{ secrets.CONFIG_RECAPTCHA_SITE_KEY }} + CONFIG_RECAPTCHA_SECRET_KEY: ${{ secrets.CONFIG_RECAPTCHA_SECRET_KEY }} + DEPLOY_DIRECTORY: ${{ secrets.DEPLOY_DIRECTORY }} + DEPLOY_LEBEDA: ${{ secrets.DEPLOY_LEBEDA }} + DEPLOY_SSH_HOST: ${{ secrets.DEPLOY_SSH_HOST }} + DEPLOY_SSH_IP: ${{ secrets.DEPLOY_SSH_IP }} + DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} + DEPLOY_SSH_PORT: ${{ secrets.DEPLOY_SSH_PORT }} + DEPLOY_SSH_USERNAME: ${{ secrets.DEPLOY_SSH_USERNAME }} + steps: + - uses: actions/checkout@v3 + - run: git config --global --add safe.directory '*' + # Copy & paste from https://github.com/actions/cache/blob/master/examples.md#php---composer + - name: Get composer cache + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Install yarn + run: | + apt-get update + apt-get install -y npm + npm install --global yarn + #Copy & paste from https://github.com/actions/cache/blob/master/examples.md#node---yarn + - name: Get yarn cache + id: yarn-cache + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + - uses: actions/cache@v3 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Setup SSH key and deploy + run: | + mkdir -p /root/.ssh + ssh-keyscan -H "${DEPLOY_SSH_HOST}","${DEPLOY_SSH_IP}" >> /root/.ssh/known_hosts + eval `ssh-agent -s` + echo "${DEPLOY_SSH_KEY}" | tr -d '\r' | ssh-add - + phing deploy