Created
November 16, 2022 16:45
-
-
Save kagg-design/5ab87fba2d9e5b5d53bba2b7454aa3e3 to your computer and use it in GitHub Desktop.
GitHub action to deploy the plugin to the staging environment on commit to master
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 to Stage | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
release: | |
name: Deploy to Stage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Set up Composer caching | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-composer-dependencies | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install dependencies in prod version | |
run: | | |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} | |
composer install --no-dev | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build js app | |
run: | | |
yarn | |
yarn run build:prod | |
- name: Deploy the code | |
uses: burnett01/rsync-deployments@5.2 | |
with: | |
switches: -cvzr --delete --exclude-from=.distignore --chmod=D775,F664 | |
path: ${{ env.GITHUB_WORKSPACE }} | |
remote_path: /var/www/xxx/wp-content/plugins/yyyyy/ | |
remote_host: xxx.xxx.xxx.xxx | |
remote_user: yyyyy | |
remote_key: ${{ secrets.DEPLOY_KEY }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment