Skip to content

Commit e479824

Browse files
committed
build(ci): automate release process
- Add release workflow - Add snapshot release workflow
1 parent 862123a commit e479824

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

.github/workflows/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# GitHub Actions Workflows
2+
3+
This directory contains the GitHub Actions workflows for the project.
4+
5+
## Workflows
6+
7+
### 1. tests.yml
8+
- **Trigger**: Push to master branch or pull requests to master
9+
- **Purpose**: Run all tests (unit and integration) on multiple Tarantool versions
10+
- **Runs on**: Ubuntu latest
11+
12+
### 2. release.yml
13+
- **Trigger**: Creation of tags matching semantic versioning pattern (e.g., `1.4.0`, `2.0.1`)
14+
- **Purpose**: Automatically release to Maven Central and create GitHub Release
15+
- **Runs on**: Ubuntu latest
16+
- **Requires secrets**:
17+
- `OSSRH_USERNAME` - Sonatype OSSRH username
18+
- `OSSRH_TOKEN` - Sonatype OSSRH password or token
19+
- `MAVEN_GPG_PRIVATE_KEY` - GPG private key for signing artifacts
20+
- `MAVEN_GPG_PASSPHRASE` - Passphrase for the GPG key
21+
- `TARANTOOL_REGISTRY_PASSWORD` - Password for Tarantool private registry
22+
23+
### 3. snapshot.yml
24+
- **Trigger**: Push to master branch (except commits starting with "Release")
25+
- **Purpose**: Automatically deploy snapshot versions to Maven Central
26+
- **Runs on**: Ubuntu latest
27+
- **Requires secrets**:
28+
- `OSSRH_USERNAME` - Sonatype OSSRH username
29+
- `OSSRH_TOKEN` - Sonatype OSSRH password or token
30+
- `TARANTOOL_REGISTRY_PASSWORD` - Password for Tarantool private registry
31+
32+
## Setup Instructions
33+
34+
To enable automatic releases, you need to configure the following secrets in your GitHub repository settings:
35+
36+
1. Go to Settings → Secrets and variables → Actions
37+
2. Add the following secrets:
38+
- `OSSRH_USERNAME` - Your Sonatype OSSRH username
39+
- `OSSRH_TOKEN` - Your Sonatype OSSRH token/password
40+
- `MAVEN_GPG_PRIVATE_KEY` - Your GPG private key (export with `gpg --export-secret-keys --armor KEY_ID`)
41+
- `MAVEN_GPG_PASSPHRASE` - Passphrase for your GPG key
42+
- `TARANTOOL_REGISTRY_PASSWORD` - Password for the Tarantool private registry
43+
44+
## Release Process
45+
46+
### Automatic Release
47+
1. Create and push a new tag with semantic versioning format (e.g., `git tag 1.4.0 && git push origin 1.4.0`)
48+
2. The release workflow will automatically:
49+
- Build and test the project
50+
- Sign the artifacts with GPG
51+
- Deploy to Maven Central
52+
- Create a GitHub Release
53+
54+
### Automatic Snapshot Deployment
55+
1. Push changes to the master branch
56+
2. The snapshot workflow will automatically:
57+
- Build and test the project
58+
- Deploy snapshot version to Maven Central
59+
60+
Note: Commits with messages starting with "Release" are excluded from snapshot deployment to avoid duplicate deployments during the release process.

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release to Maven Central
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v5
14+
15+
- name: Set up JDK 8
16+
uses: actions/setup-java@v5
17+
with:
18+
distribution: 'zulu'
19+
java-version: '8'
20+
server-id: ossrh
21+
server-username: ${{ secrets.MAVEN_CENTRAL_USER }}
22+
server-password: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
23+
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
24+
gpg-passphrase: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
25+
26+
- name: Configure Git user
27+
run: |
28+
git config user.email "[email protected]"
29+
git config user.name "GitHub Actions"
30+
31+
- name: Publish to Maven Central
32+
run: |
33+
./mvnw -B clean deploy -P release -DskipTests

.github/workflows/snapshot.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Snapshot to Maven Central
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
publish-snapshot:
10+
runs-on: ubuntu-latest
11+
if: "!startsWith(github.event.head_commit.message, 'Release')"
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v5
15+
16+
- name: Set up JDK 8
17+
uses: actions/setup-java@v5
18+
with:
19+
distribution: 'zulu'
20+
java-version: '8'
21+
server-id: ossrh
22+
server-username: ${{ secrets.MAVEN_CENTRAL_USER }}
23+
server-password: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
24+
25+
- name: Publish Snapshot to Maven Central
26+
run: |
27+
./mvnw -B clean deploy -DskipTests

0 commit comments

Comments
 (0)