Skip to content

Commit cfa2b27

Browse files
authored
Adding release to GitHub packages (#6)
- adding release job and release notes - adding installation manual for Gradle and maven ## References - TODO <!-- References to relevant GitHub issues and pull requests, esp. upstream and downstream changes --> ## Submitter checklist - [ ] The PR request is well described and justified, including the body and the references - [ ] The PR title represents the desired changelog entry - [ ] The repository's code style is followed (see the contributing guide) - [ ] Test coverage that demonstrates that the change works as expected - [ ] For new features, there's necessary documentation in this pull request or in a subsequent PR to [wiremock.org](https://github.com/wiremock/wiremock.org) <!-- Put an `x` into the [ ] to show you have filled the information. The template comes from https://github.com/wiremock/.github/blob/main/.github/pull_request_template.md You can override it by creating .github/pull_request_template.md in your own repository -->
1 parent e644a9f commit cfa2b27

File tree

6 files changed

+118
-10
lines changed

6 files changed

+118
-10
lines changed

.github/release-drafter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Use https://github.com/wiremock/.github/blob/main/.github/release_drafter.yml
2+
_extends: .github

.github/workflows/build-and-test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ name: Build and test
22

33
on:
44
push:
5-
# branches: [ develop, master ]
65
branches:
76
- '**'
8-
# pull_request:
9-
# branches: [ develop, master ]
107

118
jobs:
129
validate:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
workflow_dispatch:
8+
9+
jobs:
10+
update_release_draft:
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: release-drafter/release-drafter@v5
17+
with:
18+
name: next
19+
tag: next
20+
version: next
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Set up Java
16+
uses: actions/setup-java@v3
17+
with:
18+
java-version: '11'
19+
distribution: 'adopt'
20+
- name: Validate Gradle wrapper
21+
uses: gradle/wrapper-validation-action@v1
22+
- name: Publish package
23+
uses: gradle/gradle-build-action@v2
24+
with:
25+
arguments: publish
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,54 @@ the `GET` won't have any knowledge of the previous post.
5050

5151
# Usage
5252

53+
## Compatibility matrix
54+
55+
| `wiremock-extension-state` version | `WireMock` version |
56+
|------------------------------------|--------------------|
57+
| `0.0.3` | `3.0.0-beta-11`+ |
58+
59+
## Installation
60+
61+
### Gradle
62+
63+
```groovy
64+
repositories {
65+
maven {
66+
url = uri("https://maven.pkg.github.com/wiremock/wiremock-extension-state")
67+
}
68+
}
69+
70+
71+
dependencies {
72+
testImplementation("org.wiremock:wiremock-state-extension:<your-version>")
73+
}
74+
```
75+
76+
### Maven
77+
78+
Follow the instructions on [GitHub Docs](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry) to
79+
add authentication to GitHub packages.
80+
81+
```xml
82+
83+
<repositories>
84+
<repository>
85+
<id>github-wiremock-extension-state</id>
86+
<name>WireMock Extension State Apache Maven Packages</name>
87+
<url>https://maven.pkg.github.com/wiremock/wiremock-extension-state</url>
88+
</repository>
89+
</repositories>
90+
91+
<dependencies>
92+
<dependency>
93+
<groupId>org.wiremock</groupId>
94+
<artifactId>wiremock-state-extension</artifactId>
95+
<version>your-version</version>
96+
<scope>test</scope>
97+
</dependency>
98+
</dependencies>
99+
```
100+
53101
## Register extension
54102

55103
This extension makes use of Wiremock's `ExtensionFactory`, so only one extension has to be registered: `StateExtension`.
@@ -198,12 +246,13 @@ Full example:
198246

199247
### state expiration
200248

201-
This extension provides a `CaffeineStore` which uses [caffeine](https://github.com/ben-manes/caffeine) to store the current state and to achieve an expiration (to avoid memory leaks).
249+
This extension provides a `CaffeineStore` which uses [caffeine](https://github.com/ben-manes/caffeine) to store the current state and to achieve an expiration (
250+
to avoid memory leaks).
202251
The default expiration is 60 minutes. The default value can be overwritten (`0` = default = 60 minutes):
203252

204253
```java
205254
int expiration=1024;
206-
var store = new CaffeineStore(expiration);
255+
var store=new CaffeineStore(expiration);
207256
```
208257

209258
## Match a request against a context

build.gradle

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ plugins {
1212
id 'maven-publish'
1313
id 'jacoco'
1414
id 'com.diffplug.spotless' version '6.19.0'
15+
id 'com.palantir.git-version' version '3.0.0'
1516
}
1617

1718
wrapper {
1819
gradleVersion = '7.2'
1920
distributionType = Wrapper.DistributionType.BIN
2021
}
21-
project.archivesBaseName = 'state'
22+
project.archivesBaseName = 'wiremock-state-extension'
2223
project.ext {
2324
versions = [
2425
wiremock : '3.0.0-beta-12',
@@ -32,19 +33,29 @@ project.ext {
3233
}
3334

3435

35-
group 'com.github.dirkbolte.wiremock.extensions'
36-
version '0.0.2-3.0.0-beta-11'
36+
group 'org.wiremock'
3737

38+
version gitVersion()
3839

3940
publishing {
41+
repositories {
42+
maven {
43+
name = "GitHubPackages"
44+
url = "https://maven.pkg.github.com/wiremock/wiremock-extension-state"
45+
credentials {
46+
username = System.getenv("GITHUB_ACTOR")
47+
password = System.getenv("GITHUB_TOKEN")
48+
}
49+
}
50+
}
4051
publications {
4152
mavenJava(MavenPublication) {
42-
artifactId = 'state'
53+
artifactId = 'wiremock-state-extension'
4354

4455
from components.java
4556

4657
pom {
47-
name = 'state'
58+
name = 'wiremock-state-extension'
4859
description = 'A WireMock extension to transfer state in between stubs'
4960
url = 'https://github.com/dirkbolte/wiremock-extension-state'
5061

0 commit comments

Comments
 (0)