update readme #189
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: hb | |
on: [push] | |
jobs: | |
build_backend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.0' | |
env: | |
fail-fast: true | |
- name: Install deps | |
run: composer install --ansi | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: backend-deps | |
path: vendor | |
build_frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: Install deps | |
uses: borales/actions-yarn@v5 | |
with: | |
cmd: install | |
- name: Build deps | |
uses: borales/actions-yarn@v5 | |
with: | |
cmd: build | |
env: | |
NODE_ENV: production | |
- name: Build hb-events | |
working-directory: ./hb-events | |
run: | | |
yarn install | |
yarn build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: frontend-deps | |
path: | | |
frontend/dist | |
hb-events/build | |
pack: | |
runs-on: ubuntu-latest | |
needs: | |
- build_backend | |
- build_frontend | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download backend artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: backend-deps | |
- name: Download frontend artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: frontend-deps | |
- name: Pack files for release | |
run: | | |
zip -r brontosaurus-theme.zip . \ | |
-i "config/*" \ | |
-i "CoordinatesResolver/*" \ | |
-i "DataContainers/*" \ | |
-i "Filters/*" \ | |
-i "frontend/*" \ | |
-x "frontend/src/*" \ | |
-i "hb-events/*" \ | |
-x "hb-events/src/*" \ | |
-i "images/*" \ | |
-i "log/*" \ | |
-i "Rewrites/*" \ | |
-i "scripts/*" \ | |
-i "template-parts/*" \ | |
-i "vendor/*" \ | |
-i "webfonts/*" \ | |
-i "archive-novinky.php" \ | |
-i "Assets.php" \ | |
-i "bootstrap.php" \ | |
-i "composer.json" \ | |
-i "composer.lock" \ | |
-i "Configuration.php" \ | |
-i "Container.php" \ | |
-i "exceptions.php" \ | |
-i "footer.php" \ | |
-i "functions.php" \ | |
-i "header.php" \ | |
-i "helpers.php" \ | |
-i "homepage-banner.php" \ | |
-i "index.php" \ | |
-i "PostTypeInitializer.php" \ | |
-i "PropertyHandler.php" \ | |
-i "screenshot.png" \ | |
-i "single-novinky.php" \ | |
-i "style.css" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deps | |
path: brontosaurus-theme.zip | |
deploy_staging: | |
runs-on: ubuntu-latest | |
if: ${{ ! startsWith(github.ref_name, 'dependabot') }} | |
needs: pack | |
environment: | |
name: staging | |
url: https://dev.brontosaurus.cz | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: deps | |
- name: Extract files to deploy | |
run: | | |
mkdir -p deploy/files | |
unzip brontosaurus-theme.zip -d deploy/files | |
- name: Set up SSH connection | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SERVER_KEYSCAN }}" > ~/.ssh/known_hosts | |
echo "${{ secrets.KEY_PRIVATE }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa | |
echo "${{ secrets.KEY_PUBLIC }}" > ~/.ssh/id_rsa.pub | |
- name: Deploy | |
run: | | |
bash deploy/deploy.sh ${{ secrets.STAGING_REMOTE_USER_AND_HOST }}:${{ secrets.STAGING_REMOTE_PROJECT_DIR }}/wp-content/themes/brontosaurus-theme | |
ssh ${{ secrets.STAGING_REMOTE_USER_AND_HOST }} "rm -rf ${{ secrets.STAGING_REMOTE_PROJECT_DIR }}/wp-content/themes/brontosaurus-theme/temp/cache" | |
deploy_production: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref_name == 'main' }} | |
needs: pack | |
environment: | |
name: production | |
url: https://brontosaurus.cz | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: deps | |
- name: Extract files to deploy | |
run: | | |
mkdir -p deploy/files | |
unzip brontosaurus-theme.zip -d deploy/files | |
- name: Set up SSH connection | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SERVER_KEYSCAN }}" > ~/.ssh/known_hosts | |
echo "${{ secrets.KEY_PRIVATE }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa | |
echo "${{ secrets.KEY_PUBLIC }}" > ~/.ssh/id_rsa.pub | |
- name: Deploy | |
run: | | |
bash deploy/deploy.sh ${{ secrets.PRODUCTION_REMOTE_USER_AND_HOST }}:${{ secrets.PRODUCTION_REMOTE_PROJECT_DIR }}/wp-content/themes/brontosaurus-theme | |
ssh ${{ secrets.PRODUCTION_REMOTE_USER_AND_HOST }} "rm -rf ${{ secrets.PRODUCTION_REMOTE_PROJECT_DIR }}/wp-content/themes/brontosaurus-theme/temp/cache" |