Skip to content

Commit f4449a2

Browse files
authored
Merge pull request #31 from Automattic/release
Create releases
2 parents 01a0fc4 + e3031fa commit f4449a2

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

.github/workflows/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.secrets

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Create a draft release when a tag is pushed
2+
name: Create a release
3+
4+
on:
5+
# Allow manual trigger from the Actions tab:
6+
# https://github.com/Automattic/wp-openid-connect-server/actions/workflows/release.yml
7+
workflow_dispatch:
8+
9+
push:
10+
tags: ['v*']
11+
12+
jobs:
13+
create-release:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
21+
- name: Install composer dependencies
22+
run: composer install --no-ansi --no-dev --no-interaction --no-plugins --no-scripts --optimize-autoloader
23+
24+
- name: Generate readme.txt
25+
run: php bin/transform-readme.php
26+
27+
- name: Create directory for release
28+
run: mkdir /tmp/release
29+
30+
- name: Copy all files to release directory
31+
run: cp -r ./* /tmp/release/
32+
33+
- name: Remove unnecessary files and directories
34+
run: |
35+
rm -rf /tmp/release/.github
36+
rm -rf /tmp/release/.git
37+
rm -rf /tmp/release/bin
38+
rm -rf /tmp/release/README.md
39+
rm -rf /tmp/release/.wp-env.json
40+
rm -rf /tmp/release/phpcs.xml
41+
42+
- name: Move and rename release directory
43+
run: mv /tmp/release wp-openid-connect-server
44+
45+
- name: Create archive for release
46+
run: tar -cvzf wp-openid-connect-server-${{ github.ref_name }}.tar.gz wp-openid-connect-server
47+
48+
- name: Create release
49+
uses: ncipollo/release-action@v1
50+
with:
51+
token: ${{ secrets.GITHUB_TOKEN }}
52+
tag: ${{ github.ref_name }}
53+
artifacts: "wp-openid-connect-server-${{ github.ref_name }}.tar.gz"
54+
artifactErrorsFailBuild: true
55+
draft: true

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,26 @@ wp-env run cli "wp rewrite structure '/%postname%'"
1414
```
1515

1616
The site is now available at http://localhost:8888.
17+
18+
19+
## Release
20+
Plugin releases are automatically created through a GitHub Action, which is executed whenever a tag of the form `vX.Y.Z` is pushed. You can create and push a tag as follows.
21+
22+
First find the latest tag:
23+
24+
```shell
25+
# Fetch tags from origin
26+
git fetch
27+
28+
# Returns the latest tag, e.g. v0.1.0
29+
git describe --tags --abbrev=0
30+
```
31+
32+
Then create and push a tag that increments the latest one as per [Semantic Versioning](https://semver.org/):
33+
34+
```shell
35+
git tag v0.1.1
36+
git push origin v0.1.1
37+
```
38+
39+
The [GitHub Action](https://github.com/Automattic/wp-openid-connect-server/actions) will launch automatically, and when completed will have created a **draft release** for the tag that was pushed. You should then edit that release to provide a meaningful title and description (ideally including a [changelog](https://keepachangelog.com/en/1.0.0/)), then publish the release.

0 commit comments

Comments
 (0)