-
-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (94 loc) · 2.96 KB
/
reusable-deploy-assets.yml
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: Deploy Assets
on:
workflow_call:
inputs:
plugin:
required: true
type: string
description: The plugin slug
readme:
required: true
type: string
description: The plugin readme file name, either readme.md or readme.txt
node:
required: true
type: boolean
description: Whether to run the Node build step and add the assets to the commit
vendor:
required: true
type: boolean
description: Whether to generate the Composer autoloader files and add them to the commit
secrets:
WPORG_SVN_USERNAME:
required: true
WPORG_SVN_PASSWORD:
required: true
permissions: {}
jobs:
wordpress:
name: WordPress.org
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install PHP
if: ${{ inputs.vendor }}
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: composer:v2
coverage: none
ini-file: development
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install Node Dependencies
if: ${{ inputs.node }}
run: npm ci
- name: Generate autoload file
if: ${{ inputs.vendor }}
run: | #shell
composer install
# We can't call `composer run build-vendor` here because the script itself messes with
# Composer dependencies and can result in a fatal error when dev dependencies are removed.
./vendor/johnbillion/plugin-infrastructure/bin/build-vendor
git add -f vendor/autoload.php
git add -f vendor/composer/*
- name: Build Assets
if: ${{ inputs.node }}
run: | #shell
npm run build
git add -f assets/*
- name: Populate Changelog
run: | #shell
node vendor/johnbillion/plugin-infrastructure/bin/changelog.js "${README}"
git add "${README}"
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
README: ${{ inputs.readme }}
- name: Commit
run: | #shell
git config user.name github-actions
git config user.email github-actions@github.com
git commit -m "Assets"
- name: Install SVN
run: | #shell
sudo apt-get update
sudo apt-get install -y subversion
svn --version
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-asset-update@2.1.2
env:
SVN_USERNAME: ${{ secrets.WPORG_SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.WPORG_SVN_PASSWORD }}