Repository navigation
bump up plugin version #25
This file contains hidden or 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: SqlToCpt Release | |
| on: | |
| push: | |
| branches: | |
| - "release-*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| if: startsWith(github.ref_name, 'release-') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Confirm branch | |
| run: | | |
| echo "Release workflow triggered on branch: ${{ github.ref_name }}" | |
| - name: Checkout release branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| - name: Set up Node.js 20.x | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20.x | |
| - name: Install NPM | |
| run: | | |
| yarn install | |
| - name: Check JS Linting | |
| run: | | |
| yarn lint:js | |
| - name: Run JS Unit Tests | |
| run: | | |
| yarn test:js | |
| - name: Set up PHP v8.2 | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.2" | |
| - name: Validate Composer | |
| run: | | |
| composer validate --strict | |
| - name: Install Composer | |
| run: | | |
| composer install --prefer-dist --no-progress | |
| - name: Check PHP Linting | |
| run: | | |
| composer run lint | |
| - name: Run PHP Unit Tests | |
| run: | | |
| composer run test | |
| - name: Set Git identity | |
| run: | | |
| git config user.email "badasswpdev@gmail.com" | |
| git config user.name "badasswp" | |
| - name: Create / reset release-built branch | |
| run: | | |
| BUILT_BRANCH="${{ github.ref_name }}-built" | |
| echo "BUILT_BRANCH=$BUILT_BRANCH" >> $GITHUB_ENV | |
| git checkout -B "$BUILT_BRANCH" | |
| - name: Clear Yarn cache | |
| run: yarn cache clean | |
| - name: Build Dist folder | |
| run: | | |
| yarn install && yarn build | |
| git add dist/ -f | |
| git rm package.json | |
| - name: Build Vendor folder | |
| run: | | |
| composer install --no-dev | |
| git add vendor/ -f | |
| - name: Clean Up Files | |
| run: | | |
| if [ -f .deployignore ]; then | |
| while IFS= read -r file; do | |
| git rm -rf "$file" | |
| done < .deployignore | |
| git rm .deployignore | |
| fi | |
| git clean -f yarn.lock | |
| git clean -f node_modules | |
| git clean -f composer.lock | |
| - name: Commit & push release-built branch | |
| run: | | |
| git commit -m "Build from ${{ github.ref_name }}" | |
| git push origin "$BUILT_BRANCH" --force | |
| - name: Deploy to Staging | |
| uses: SamKirkland/FTP-Deploy-Action@v4.3.6 | |
| with: | |
| server: ${{ secrets.FTP_HOST }} | |
| username: ${{ secrets.FTP_USERNAME }} | |
| password: ${{ secrets.FTP_PASSWORD }} | |
| server-dir: wp-stg/wp-content/plugins/sql-to-cpt/ |