Skip to content

Commit f7e01f4

Browse files
Upgrade workflows for repo and allow for version updates/prep
1 parent 8ad793c commit f7e01f4

4 files changed

Lines changed: 175 additions & 5 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Prepare Release Branch
2+
env:
3+
PR_PREFIX: 'Pods Gravity Forms '
4+
PR_LABELS: 'Type: Release'
5+
MILESTONE_PREFIX: 'Pods Gravity Forms '
6+
BRANCH_PREFIX: 'release/'
7+
WPORG_PLUGIN_FILE: 'pods-gravity-forms.php'
8+
WPORG_PLUGIN_VERSION_CONSTANT_NAME: 'PODS_GF_VERSION'
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
new_plugin_version:
13+
description: 'New plugin version (without the "-a-1"), defaults to the next incremental version from package.json'
14+
required: false
15+
version_increment:
16+
description: 'OR Version increment scheme (if incrementing the package.json version; patch=x.x.x, minor=x.x, major=x.0)'
17+
required: true
18+
type: choice
19+
default: 'patch'
20+
options:
21+
- 'major'
22+
- 'minor'
23+
- 'patch'
24+
jobs:
25+
prepare_release_branch:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout the code
29+
uses: actions/checkout@v4
30+
with:
31+
token: ${{ secrets.GH_BOT_PUSH }}
32+
- name: Maybe use the version number from inputs
33+
if: ${{ github.event.inputs.new_plugin_version != null && github.event.inputs.new_plugin_version != '' }}
34+
shell: bash
35+
run: |
36+
echo "PLUGIN_VERSION=${{ github.event.inputs.new_plugin_version }}" >> $GITHUB_ENV
37+
- name: Maybe lookup the version number from package.json
38+
id: version-lookup
39+
if: ${{ github.event.inputs.new_plugin_version == null || github.event.inputs.new_plugin_version == '' }}
40+
shell: bash
41+
run: |
42+
echo "CURRENT_VERSION=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
43+
- name: Maybe get the next version information
44+
if: ${{ steps.version-lookup.outputs.CURRENT_VERSION != null && steps.version-lookup.outputs.CURRENT_VERSION != '' }}
45+
uses: reecetech/version-increment@2023.10.2
46+
id: version-increment
47+
with:
48+
scheme: semver
49+
increment: ${{ github.event.inputs.version_increment }}
50+
- name: Maybe store the next version
51+
if: ${{ steps.version-increment.outputs.version != null && steps.version-increment.outputs.version != '' }}
52+
shell: bash
53+
run: |
54+
echo "PLUGIN_VERSION=${{ steps.version-increment.outputs.version }}" >> $GITHUB_ENV
55+
- name: What are we doing?
56+
run: |
57+
echo PLUGIN_VERSION: ${{ env.PLUGIN_VERSION }}
58+
- name: Run wporg-replace
59+
uses: sc0ttkclark/wporg-replace@v1.0.7
60+
with:
61+
plugin_version: '${{ env.PLUGIN_VERSION }}-a-1'
62+
plugin_version_constant_name: ${{ env.WPORG_PLUGIN_VERSION_CONSTANT_NAME }}
63+
plugin_file: ${{ env.WPORG_PLUGIN_FILE }}
64+
plugin_path: ${{ github.workspace }}
65+
- name: Create Milestone
66+
id: create-milestone
67+
uses: WyriHaximus/github-action-create-milestone@v1.2.0
68+
continue-on-error: true
69+
with:
70+
title: '${{ env.MILESTONE_PREFIX }}${{ env.PLUGIN_VERSION }}'
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GH_BOT_PUSH }}
73+
- name: Create Pull Request
74+
id: create-pull-request
75+
uses: peter-evans/create-pull-request@v5.0.2
76+
with:
77+
token: ${{ secrets.GH_BOT_PUSH }}
78+
branch: '${{ env.BRANCH_PREFIX }}${{ env.PLUGIN_VERSION }}'
79+
commit-message: 'Set version to ${{ env.PLUGIN_VERSION }}-a-1'
80+
title: '${{ env.PR_PREFIX }}${{ env.PLUGIN_VERSION }}'
81+
labels: ${{ env.PR_LABELS }}
82+
assignees: ${{ github.actor }}
83+
milestone: ${{ steps.create-milestone.outputs.number }}
84+
draft: true

.github/workflows/wordpress-plugin-deploy.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ jobs:
77
name: New tag
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@master
10+
- name: Check the version number from package.json
11+
shell: bash
12+
run: echo "PLUGIN_VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
13+
- name: Checkout the code
14+
uses: actions/checkout@v4
1115
- name: WordPress Plugin Deploy
1216
uses: 10up/action-wordpress-plugin-deploy@master
1317
env:
1418
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
1519
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
20+
VERSION: ${{ env.PLUGIN_VERSION }}
1621
- name: Send message to Slack API
17-
uses: archive/github-actions-slack@v2.0.0
22+
uses: archive/github-actions-slack@v2.7.0
1823
id: notify
1924
with:
2025
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
2126
slack-channel: C02SWND14
22-
slack-text: The pods-gravity-forms tag has been deployed to svn.wordpress.org 🎉
23-
- name: Output Slack response
24-
run: echo "The result was ${{ steps.notify.outputs.slack-result }}"
27+
slack-text: The ${{ github.event.repository.name }} tag has been deployed to svn.wordpress.org 🎉
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: WordPress.org Update Versions
2+
env:
3+
WPORG_PLUGIN_FILE: 'pods-gravity-forms.php'
4+
WPORG_PLUGIN_VERSION_CONSTANT_NAME: 'PODS_GF_VERSION'
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
plugin_version:
9+
description: 'Plugin version'
10+
required: false
11+
tested_wp_version:
12+
description: 'Tested up to WP version'
13+
required: false
14+
minimum_wp_version:
15+
description: 'Minimum WP version'
16+
required: false
17+
minimum_php_version:
18+
description: 'Minimum PHP version'
19+
required: false
20+
minimum_mysql_version:
21+
description: 'Minimum MySQL version'
22+
required: false
23+
pull_request:
24+
paths:
25+
- 'package.json'
26+
jobs:
27+
wporg_replace:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: What are we doing?
31+
run: |
32+
echo plugin_version: ${{ github.event.inputs.plugin_version }}
33+
echo tested_wp_version: ${{ github.event.inputs.tested_wp_version }}
34+
echo minimum_wp_version: ${{ github.event.inputs.minimum_wp_version }}
35+
echo minimum_php_version: ${{ github.event.inputs.minimum_php_version }}
36+
- name: Checkout the code
37+
uses: actions/checkout@v4
38+
with:
39+
token: ${{ secrets.GH_BOT_PUSH }}
40+
- name: Check the version number from package.json
41+
shell: bash
42+
run: echo "PLUGIN_VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
43+
- name: Run wporg-replace
44+
uses: sc0ttkclark/wporg-replace@v1.0.7
45+
with:
46+
plugin_version: ${{ (github.event.inputs.plugin_version != '') && github.event.inputs.plugin_version || env.PLUGIN_VERSION }}
47+
plugin_version_constant_name: ${{ env.WPORG_PLUGIN_VERSION_CONSTANT_NAME }}
48+
tested_wp_version: ${{ github.event.inputs.tested_wp_version }}
49+
minimum_wp_version: ${{ github.event.inputs.minimum_wp_version }}
50+
minimum_php_version: ${{ github.event.inputs.minimum_php_version }}
51+
plugin_file: ${{ env.WPORG_PLUGIN_FILE }}
52+
plugin_path: ${{ github.workspace }}
53+
- name: Commit changes
54+
id: auto-commit-action
55+
uses: stefanzweifel/git-auto-commit-action@v4
56+
with:
57+
file_pattern: ${{ env.WPORG_PLUGIN_FILE }} readme.txt package.json
58+
commit_message: Update wporg version(s)
59+
- name: "Run if changes have been detected"
60+
if: steps.auto-commit-action.outputs.changes_detected == 'true'
61+
run: echo "Changes!"
62+
- name: "Run if no changes have been detected"
63+
if: steps.auto-commit-action.outputs.changes_detected == 'false'
64+
run: echo "No Changes!"

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "pods-gravity-forms",
3+
"version": "1.4.5",
4+
"description": "PIntegration with Gravity Forms; Provides a UI for mapping a Form's submissions into a Pod.",
5+
"author": "Pods Foundation, Inc",
6+
"homepage": "https://pods.io/",
7+
"bugs": "https://github.com/pods-framework/pods-gravity-forms/issues",
8+
"repository": {
9+
"type": "git",
10+
"url": "git://github.com/pods-framework/pods-gravity-forms.git"
11+
},
12+
"support": "https://support.pods.io/",
13+
"funding": {
14+
"type": "individual",
15+
"url": "https://friends.pods.io/"
16+
},
17+
"license": "GPL-2.0+",
18+
"contributors": "https://github.com/pods-framework/pods-gravity-forms/graphs/contributors"
19+
}

0 commit comments

Comments
 (0)