-
Notifications
You must be signed in to change notification settings - Fork 212
152 lines (126 loc) · 5.59 KB
/
release.yml
File metadata and controls
152 lines (126 loc) · 5.59 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: "Release New Version"
run-name: "Release ${{ inputs.version }}"
on:
workflow_dispatch:
inputs:
version:
description: "The version to be released in PECL format (e.g. 1.19.1, 1.20.0beta1)"
required: true
type: "string"
jira-version-number:
description: "JIRA version ID (e.g. 54321)"
required: true
type: "string"
env:
default-release-message: |
The PHP team is happy to announce that version {0} of the MongoDB PHP extension is now available.
- [mongodb/mongodb-extension](https://packagist.org/packages/mongodb/mongodb-extension#{0}) on Packagist.
- [mongodb](https://pecl.php.net/package/mongodb) on PECL
**Release Highlights**
TODO: one or more paragraphs describing important changes in this release
A complete list of resolved issues in this release may be found in [JIRA](https://jira.mongodb.org/secure/ReleaseNote.jspa?version={1}&projectId=12484).
**Documentation**
Documentation is available on [PHP.net](https://www.php.net/mongodb).
**Installation**
You can either download and install the source manually, or you can install the extension with:
```
pie install mongodb/mongodb-extension:{0}
```
Sources and Windows binaries are attached to the GitHub release notes.
jobs:
prepare-release:
environment: release
name: "Prepare release"
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: "Check version number format"
run: |
if ! [[ "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+((alpha|beta|RC)[0-9]+)?$ ]]; then
echo '❌ Version ${{ inputs.version }} does not match expected format' >> $GITHUB_STEP_SUMMARY
exit 1
fi
- name: "Create release output"
run: echo '🎬 Release process for version ${{ inputs.version }} started by @${{ github.triggering_actor }}' >> $GITHUB_STEP_SUMMARY
- name: "Generate token and checkout repository"
uses: mongodb-labs/drivers-github-tools/secure-checkout@v3
with:
app_id: ${{ vars.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
submodules: true
fetch-depth: 0
- name: "Set up drivers-github-tools"
uses: mongodb-labs/drivers-github-tools/setup@v3
with:
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
aws_region_name: ${{ vars.AWS_REGION_NAME }}
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
- name: "Create package commit"
uses: mongodb-labs/drivers-github-tools/bump-version@v3
with:
version: ${{ inputs.version }}
# Note: this script will fail and abort if the requested version can't be released
version_bump_script: "./bin/update-release-version.php release"
commit_template: 'Package ${VERSION}'
# Don't push changes as we're creating a second commit later
push_commit: false
- name: "Create release tag"
uses: mongodb-labs/drivers-github-tools/tag-version@v3
with:
version: ${{ inputs.version }}
tag_message_template: 'Release ${VERSION}'
# Don't push tag, we'll do that after merging up
push_tag: false
- name: "Bump to next development release and commit"
uses: mongodb-labs/drivers-github-tools/bump-version@v3
with:
version: ${{ inputs.version }}
version_bump_script: "./bin/update-release-version.php to-next-dev"
commit_template: 'Back to -dev'
# Don't push commit, we still need to merge up
push_commit: false
- name: "Determine branch to merge up to"
id: get-next-branch
uses: alcaeus/automatic-merge-up-action/get-next-branch@1.0.1
with:
ref: ${{ github.ref_name }}
branchNamePattern: 'v<major>.<minor>'
devBranchNamePattern: 'v<major>.x'
ignoredBranches: ${{ vars.IGNORED_MERGE_UP_BRANCHES }}
- name: "Manually merge up changes"
if: ${{ steps.get-next-branch.outputs.hasNextBranch }}
run: |
git checkout ${NEXT_BRANCH}
git merge --strategy=ours ${RELEASE_BRANCH}
git push origin ${NEXT_BRANCH}
git checkout ${RELEASE_BRANCH}
env:
NEXT_BRANCH: ${{ steps.get-next-branch.outputs.branchName }}
RELEASE_BRANCH: ${{ github.ref_name }}
- name: "Push tag and release branch"
run: |
git push origin ${RELEASE_BRANCH}
git push origin tag ${{ inputs.version }}
env:
RELEASE_BRANCH: ${{ github.ref_name }}
- name: "Prepare release message"
run: |
cat > release-message <<'EOL'
${{ format(env.default-release-message, inputs.version, inputs.jira-version-number) }}
EOL
- name: "Create draft release"
run: |
if [[ "${{ inputs.version }}" =~ (alpha|beta|RC) ]]; then
PRERELEASE="--prerelease --latest=false"
fi
echo "RELEASE_URL=$(gh release create ${{ inputs.version }} ${PRERELEASE} --target ${{ github.ref_name }} --title "${{ inputs.version }}" --notes-file release-message --draft)" >> "$GITHUB_ENV"
- name: "Set summary"
run: |
echo '🚀 Created tag and drafted release for version [${{ inputs.version }}](${{ env.RELEASE_URL }})' >> $GITHUB_STEP_SUMMARY
echo '✍️ You may now update the release notes and publish the release when ready' >> $GITHUB_STEP_SUMMARY