Skip to content

Commit

Permalink
ci: experiment with auto deployment to idcloudhost shared-hosting
Browse files Browse the repository at this point in the history
Signed-off-by: Fery Wardiyanto <[email protected]>
  • Loading branch information
feryardiant committed Apr 1, 2024
1 parent 4f49ef1 commit 50c004c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 21 deletions.
57 changes: 36 additions & 21 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,47 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ needs.prepare.outputs.composer-cache }}
key: php-8.1-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: php-8.1-composer-

- name: Download assets
id: download
uses: actions/download-artifact@v4
with:
name: build-${{ env.APP_ENV }}
path: public

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress --ansi

- name: Deploy
uses: deployphp/action@master
env:
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_RESET: ${{ github.event_name == 'workflow_dispatch' && inputs.reset || false }}
DEPLOY_ARGS: --branch ${{ needs.prepare.outputs.target-branch }} --${{ env.DB_RESET == 'true' && 'reset' || 'no-reset' }}
- name: Checkout
uses: actions/checkout@v4
with:
private-key: ${{ secrets.DEPLOY_SSH_RSAKEY }}
ssh-config: ${{ secrets.DEPLOY_SSH_CONFIG }}
verbosity: ''
dep: deploy -f scripts/deploy.php env=staging ${{ env.DEPLOY_ARGS }}
ssh-strict: false
ssh-key: ${{ secrets.DEPLOY_SSH_RSAKEY }}
repository: [email protected]:~/git/creasico-skeleton.git
path: storage/deploy-tmp
fetch-depth: 0

- name: Prepare deployment
run: |
composer extract
cd storage/deploy-tmp
git status
# - name: Cache Composer dependencies
# uses: actions/cache@v4
# with:
# path: ${{ needs.prepare.outputs.composer-cache }}
# key: php-8.1-composer-${{ hashFiles('**/composer.lock') }}
# restore-keys: php-8.1-composer-

# - name: Install dependencies
# run: composer install --prefer-dist --no-interaction --no-progress --ansi

# - name: Deploy
# uses: deployphp/action@master
# env:
# DB_USERNAME: ${{ secrets.DB_USERNAME }}
# DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
# DB_RESET: ${{ github.event_name == 'workflow_dispatch' && inputs.reset || false }}
# DEPLOY_ARGS: --branch ${{ needs.prepare.outputs.target-branch }} --${{ env.DB_RESET == 'true' && 'reset' || 'no-reset' }}
# with:
# private-key: ${{ secrets.DEPLOY_SSH_RSAKEY }}
# ssh-config: ${{ secrets.DEPLOY_SSH_CONFIG }}
# verbosity: ''
# dep: deploy -f scripts/deploy.php env=staging ${{ env.DEPLOY_ARGS }}
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
"Composer\\Config::disableProcessTimeout",
"dep --ansi -f scripts/deploy.php"
],
"export": [
"git archive --format=tar --prefix=deploy-tmp/ HEAD | (cd storage && tar xf -)",
"rsync -av --exclude='*.map' public/build storage/deploy-tmp/public/",
"rm storage/deploy-tmp/public/.gitignore"
],
"fix": [
"pint --preset laravel --ansi"
],
Expand Down
1 change: 1 addition & 0 deletions storage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/deploy-tmp

0 comments on commit 50c004c

Please sign in to comment.