Add the Items #3
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 | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
env: | |
BUILD_SOURCE_DIR: . | |
BUILD_ARTIFACT_STAGING_DIR: build/ | |
BUILD_ARTIFACT_DESTINATION_DIR: /domains/ysbrand.dev/deployment/uploads/ | |
SENTRY_ORG: sa-proto | |
SENTRY_PROJECT: sa-proto-website | |
steps: | |
- name: 🛎️ Checkout project | |
uses: actions/checkout@v3 | |
- name: 🔍 Read .env | |
run: grep -E 'PHP_VERSION|NODE_VERSION' .env.prod >> $GITHUB_ENV | |
- name: 🖱️ Setup PHP v${{ env.PHP_VERSION }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
- name: 📥 Install back-end dependencies | |
run: composer install --no-interaction --prefer-dist --no-dev --optimize-autoloader | |
- name: 🖱️ Set Node v${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: npm | |
- name: 📥 Install front-end dependencies | |
run: npm ci --ignore-scripts | |
- name: 🔨 build front-end | |
run: npm run build | |
- name: 🗑️ Remove storage directory | |
run: rm -rf storage | |
- name: 📁 Create build directory | |
run: mkdir ${{ env.BUILD_ARTIFACT_STAGING_DIR }} | |
- name: 🗄️ ZIP Build | |
uses: TheDoctor0/[email protected] | |
with: | |
filename: ${{ env.BUILD_ARTIFACT_STAGING_DIR }}build.zip | |
path: ${{ env.BUILD_SOURCE_DIR }} | |
exclusions: 'storage/* build/* node_modules/*' | |
- name: ➗ Calculate checksum | |
run: openssl md5 ${{ env.BUILD_ARTIFACT_STAGING_DIR }}build.zip | cut -d" " -f2 > ${{ env.BUILD_ARTIFACT_STAGING_DIR }}checksum.txt | |
- name: 📂 Sync files | |
uses: SamKirkland/[email protected] | |
with: | |
server: ${{ secrets.HOST_SERVER }} | |
username: ${{ secrets.FTP_USER }} | |
password: ${{ secrets.FTP_PASSWORD }} | |
local-dir: ${{ env.BUILD_ARTIFACT_STAGING_DIR }} | |
server-dir: ${{ env.BUILD_ARTIFACT_DESTINATION_DIR }} |