|
| 1 | +name: Build, Tag and Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - release |
| 6 | + |
| 7 | +permissions: |
| 8 | + pull-requests: write |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + check-status: |
| 13 | + name: Check Status |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + is-plugin-update: ${{ steps.set-outputs.outputs.is-plugin-update }} |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + - id: get-changed-files |
| 20 | + uses: jitterbit/get-changed-files@v1 |
| 21 | + - id: set-outputs |
| 22 | + shell: bash |
| 23 | + run: | |
| 24 | + echo "Changed files: ${{ steps.get-changed-files.outputs.all }}" |
| 25 | + shopt -s nocasematch |
| 26 | + run_plugin_update="false" |
| 27 | + for file in ${{ steps.get-changed-files.outputs.all }}; do |
| 28 | + echo "Checking if file '$file' should trigger a plugin release" |
| 29 | + if [[ "$file" == .github/* ]] || \ |
| 30 | + [[ "$file" == .wordpress.org/* ]]; then |
| 31 | + echo "'$file' is inside an ignored directory." |
| 32 | + continue |
| 33 | + fi |
| 34 | + if [[ "$file" != readme.* ]] && \ |
| 35 | + [[ "$file" != .gitattributes ]] && \ |
| 36 | + [[ "$file" != .gitignore ]] && \ |
| 37 | + [[ "$file" != catalog-info.yml ]] && \ |
| 38 | + [[ "$file" != *composer* ]]; then |
| 39 | + echo "'$file' is not an ignored file." |
| 40 | + run_plugin_update="true" |
| 41 | + break |
| 42 | + fi |
| 43 | + done |
| 44 | + echo "is-plugin-update=${run_plugin_update}" >> $GITHUB_OUTPUT |
| 45 | + asset-only: |
| 46 | + name: WP.org Asset Only Update |
| 47 | + needs: check-status |
| 48 | + if: ${{ needs.check-status.outputs.is-plugin-update == 'false' }} |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + - name: WP.org Asset Only Update |
| 53 | + uses: 10up/action-wordpress-plugin-asset-update@stable |
| 54 | + env: |
| 55 | + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} |
| 56 | + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} |
| 57 | + tag: |
| 58 | + needs: check-status |
| 59 | + if: ${{ needs.check-status.outputs.is-plugin-update == 'true' }} |
| 60 | + name: Create Tag and Draft Release |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + - name: Build, Tag & Release |
| 65 | + uses: pantheon-systems/plugin-release-actions/build-tag-release@main |
| 66 | + with: |
| 67 | + gh_token: ${{ github.token }} |
| 68 | + readme_md: README.md |
0 commit comments