-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (94 loc) · 2.93 KB
/
deploy.yml
File metadata and controls
106 lines (94 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Deploy to WordPress.org Repository
on:
push:
branches:
- release
release:
types: [released]
jobs:
deploy_to_wp_repository:
name: Deploy to WP.org
runs-on: ubuntu-latest
env:
PLUGIN_SLUG: bit-integrations
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install frontend dependencies
run: |
pnpm install
- name: Check for SVN
id: check_svn
run: |
if ! command -v svn &> /dev/null; then
echo "SVN not found, installing..."
sudo apt-get update
sudo apt-get install -y subversion
else
echo "SVN is already installed."
fi
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: '8.x'
tools: composer:v2, wp-cli
- name: Determine if this is a release or push
id: set-test-action
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
echo "TEST_ACTION=false" >> $GITHUB_ENV
else
echo "TEST_ACTION=true" >> $GITHUB_ENV
fi
- name: Build
id: build-plugin
run: |
bash .github/build
if [ -d "${{ github.workspace }}/build/${{ env.PLUGIN_SLUG }}" ]; then
echo "free_exists=true" >> "${GITHUB_OUTPUT}"
else
echo "free_exists=false" >> "${GITHUB_OUTPUT}"
fi
- name: WordPress Plugin Deploy
if: steps.build-plugin.outputs.free_exists == 'true'
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
with:
generate-zip: true
dry-run: ${{ env.TEST_ACTION }}
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
BUILD_DIR: '${{ github.workspace }}/build/${{ env.PLUGIN_SLUG }}'
SLUG: ${{ env.PLUGIN_SLUG }}
- name: Upload release asset
if: steps.build-plugin.outputs.free_exists == 'true'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.deploy.outputs['zip-path'] }}