-
-
Notifications
You must be signed in to change notification settings - Fork 264
76 lines (76 loc) · 3.14 KB
/
prepare-release-branch.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
name: Prepare Release Branch
env:
PR_PREFIX: 'Pods '
PR_LABELS: 'Type: Release'
MILESTONE_PREFIX: 'Pods '
BRANCH_PREFIX: 'release/'
VERSION_INCREMENT: 'patch'
WPORG_PLUGIN_FILE: 'init.php'
WPORG_PLUGIN_VERSION_CONSTANT_NAME: 'PODS_VERSION'
on:
workflow_dispatch:
inputs:
new_plugin_version:
description: 'New plugin version (without the "-a-1"), defaults to the next incremental version from package.json'
required: false
jobs:
prepare_release_branch:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_BOT_PUSH }}
- name: Maybe use the version number from inputs
if: ${{ github.event.inputs.new_plugin_version != null && github.event.inputs.new_plugin_version != '' }}
shell: bash
run: |
echo "PLUGIN_VERSION=${{ github.event.inputs.new_plugin_version }}" >> $GITHUB_ENV
- name: Maybe lookup the version number from package.json
id: version-lookup
if: ${{ github.event.inputs.new_plugin_version == null || github.event.inputs.new_plugin_version == '' }}
shell: bash
run: |
echo "CURRENT_VERSION=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
- name: Maybe get the next version information
if: ${{ steps.version-lookup.outputs.CURRENT_VERSION != null && steps.version-lookup.outputs.CURRENT_VERSION != '' }}
uses: reecetech/[email protected]
id: version-increment
with:
scheme: semver
increment: ${{ env.VERSION_INCREMENT }}
- name: Maybe store the next version
if: ${{ steps.version-increment.outputs.version != null && steps.version-increment.outputs.version != '' }}
shell: bash
run: |
echo "PLUGIN_VERSION=${{ steps.version-increment.outputs.version }}" >> $GITHUB_ENV
- name: What are we doing?
run: |
echo PLUGIN_VERSION: ${{ env.PLUGIN_VERSION }}
- name: Run wporg-replace
uses: sc0ttkclark/[email protected]
with:
plugin_version: '${{ env.PLUGIN_VERSION }}-a-1'
plugin_version_constant_name: ${{ env.WPORG_PLUGIN_VERSION_CONSTANT_NAME }}
plugin_file: ${{ env.WPORG_PLUGIN_FILE }}
plugin_path: ${{ github.workspace }}
- name: Create Milestone
id: create-milestone
uses: WyriHaximus/[email protected]
continue-on-error: true
with:
title: "${{ env.MILESTONE_PREFIX }}${{ env.PLUGIN_VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Pull Request
id: create-pull-request
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GH_BOT_PUSH }}
branch: '${{ env.BRANCH_PREFIX }}${{ env.PLUGIN_VERSION }}'
commit-message: 'Set version to ${{ env.PLUGIN_VERSION }}-a-1'
title: '${{ env.PR_PREFIX }}${{ env.PLUGIN_VERSION }}'
labels: ${{ env.PR_LABELS }}
assignees: ${{ github.actor }}
milestone: ${{ steps.create-milestone.outputs.number }}
draft: true