Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: experiment with auto deployment to idcloudhost shared-hosting #110

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading