From acacf91d4fb8ef148409d9e847298b6a6c46d032 Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Thu, 2 Sep 2021 18:43:14 +0200 Subject: [PATCH] =?UTF-8?q?Relies=20solely=20on=20PHP=20=E2=80=94no=20Dock?= =?UTF-8?q?er=E2=80=94=20and=20deploys=20artefacts=20via=20SSH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/daily.yml | 39 +++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 7eb8318..61f652a 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -1,28 +1,37 @@ on: + # to be removed after testing push: + # on demand via the Actions menu + workflow_dispatch: + # automatically schedluled every two days at 1:00am schedule: - # everyday at 1am - - cron: '0 1 * * *' + - cron: '0 1 */2 * *' jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Copy packager configuration for CI - run: cp local.config.json.sample local.config.json - - - name: Setup PHP project - run: docker build -t yeswiki-build-repo . - - name: Generate packages list + - uses: nanasess/setup-php@v3.0.6 + with: + php-version: '7.4' + + - run: composer install + + - name: Copy packager configuration for CI run: | - docker run --rm -v $(pwd)/dist/:/var/www/html/repository/ yeswiki-build-repo \ - php index.php action=init + cp local.config.json.sample local.config.json + mkdir -p /var/www/html/repository/ - - name: Deploy on GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + - name: Generate packages list + run: php index.php action=init + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - # ./dist is our local folder which got the artifacts back from the 'Generate packages list' step - publish_dir: ./dist/ + key: "${{ secrets.SSH_DEPLOY_KEY }}" + # a line starting by `repository.yeswiki.net, …`as it appears in `~/.ssh/known_hosts` + known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} + + - run: rsync -avzr --delete /var/www/html/repository/ user@repository.yeswiki.net:/path/to/repository/