Skip to content

Commit a6c99de

Browse files
author
Julien Ruaux
committed
ci: Using redis github workflows
1 parent 7b778cc commit a6c99de

File tree

4 files changed

+72
-242
lines changed

4 files changed

+72
-242
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,5 @@ on:
55

66
jobs:
77
build:
8-
9-
runs-on: ubuntu-latest
10-
if: startsWith(github.event.head_commit.message, 'Releasing version') != true
11-
12-
steps:
13-
- uses: actions/checkout@v3
14-
15-
- name: Set up Java
16-
uses: actions/setup-java@v3
17-
with:
18-
distribution: zulu
19-
java-version: 11
20-
21-
- uses: actions/cache@v2
22-
with:
23-
path: ~/.m2/repository
24-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
25-
restore-keys: |
26-
${{ runner.os }}-maven-
27-
28-
- name: Build
29-
run: ./mvnw -B package --file pom.xml
30-
31-
- name: Show Reports
32-
uses: actions/upload-artifact@v3
33-
if: failure()
34-
with:
35-
name: reports-${{ runner.os }}
36-
path: build/
8+
name: 'Build'
9+
uses: redis-field-engineering/redis-github-workflows/.github/workflows/build-maven.yml@main

.github/workflows/early-access.yml

Lines changed: 26 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -6,89 +6,30 @@ on:
66

77
jobs:
88
earlyaccess:
9-
name: EarlyAccess
9+
name: 'Early Access'
10+
if: github.repository == 'redis-field-engineering/redis-kafka-connect' && startsWith(github.event.head_commit.message, 'Releasing version') != true
11+
uses: redis-field-engineering/redis-github-workflows/.github/workflows/early-access-maven.yml@main
12+
with:
13+
jreleaser-arguments: full-release
14+
java-version: '17'
15+
secrets:
16+
github-token: ${{ secrets.GIT_ACCESS_TOKEN }}
17+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
18+
gpg-public-key: ${{ secrets.GPG_PUBLIC_KEY }}
19+
gpg-secret-key: ${{ secrets.GPG_SECRET_KEY }}
20+
sonatype-username: ${{ secrets.SONATYPE_USERNAME }}
21+
sonatype-password: ${{ secrets.SONATYPE_PASSWORD }}
22+
docker-username: ${{ secrets.DOCKER_USERNAME }}
23+
docker-password: ${{ secrets.DOCKER_PASSWORD }}
24+
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
25+
26+
docker:
27+
name: 'Docker'
1028
if: startsWith(github.event.head_commit.message, 'Releasing version') != true
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v3
15-
with:
16-
fetch-depth: 0
17-
18-
- name: Set up Java
19-
uses: actions/setup-java@v3
20-
with:
21-
distribution: zulu
22-
java-version: 11
23-
24-
- uses: actions/cache@v2
25-
with:
26-
path: ~/.m2/repository
27-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28-
restore-keys: |
29-
${{ runner.os }}-maven-
30-
31-
- name: Build
32-
run: ./mvnw --no-transfer-progress -B --file pom.xml verify
33-
34-
- name: Show Reports
35-
uses: actions/upload-artifact@v3
36-
if: failure()
37-
with:
38-
name: reports-${{ runner.os }}
39-
path: target/
40-
41-
- name: Upload coverage to Codecov
42-
uses: codecov/codecov-action@v3
43-
44-
- name: Version
45-
id: vars
46-
run: echo ::set-output name=version::$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
47-
48-
- name: Assemble
49-
uses: jreleaser/release-action@v1
50-
with:
51-
arguments: assemble
52-
env:
53-
JRELEASER_PROJECT_VERSION: ${{ steps.vars.outputs.version }}
54-
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
55-
56-
- name: Release
57-
uses: jreleaser/release-action@v1
58-
with:
59-
arguments: full-release
60-
env:
61-
JRELEASER_PROJECT_VERSION: ${{ steps.vars.outputs.version }}
62-
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
63-
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
64-
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
65-
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
66-
JRELEASER_SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
67-
68-
- name: JReleaser output
69-
if: always()
70-
uses: actions/upload-artifact@v3
71-
with:
72-
name: artifact
73-
path: |
74-
out/jreleaser/trace.log
75-
out/jreleaser/output.properties
76-
out/jreleaser/release/CHANGELOG.md
77-
78-
- name: Set up QEMU
79-
uses: docker/setup-qemu-action@v2
80-
81-
- name: Set up Docker Buildx
82-
uses: docker/setup-buildx-action@v2
83-
84-
- name: Login to DockerHub
85-
uses: docker/login-action@v2
86-
with:
87-
username: ${{ secrets.DOCKER_USERNAME }}
88-
password: ${{ secrets.DOCKER_PASSWORD }}
89-
90-
- name: Build and push
91-
uses: docker/build-push-action@v3
92-
with:
93-
push: ${{ github.event_name != 'pull_request' }}
94-
tags: fieldengineering/redis-kafka-connect:early-access
29+
uses: redis-field-engineering/redis-github-workflows/.github/workflows/docker.yml@main
30+
with:
31+
tags: fieldengineering/redis-kafka-connect:early-access
32+
secrets:
33+
github-token: ${{ secrets.GIT_ACCESS_TOKEN }}
34+
docker-username: ${{ secrets.DOCKER_USERNAME }}
35+
docker-password: ${{ secrets.DOCKER_PASSWORD }}

.github/workflows/publish.yml

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,19 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: "Release version"
7+
description: 'Release version'
8+
required: true
9+
branch:
10+
description: 'Branch'
11+
default: 'master'
812
required: true
9-
jobs:
10-
release:
11-
name: Release
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v3
15-
with:
16-
fetch-depth: 0
17-
18-
- name: Set up Java
19-
uses: actions/setup-java@v3
20-
with:
21-
distribution: zulu
22-
java-version: 11
23-
24-
- uses: actions/cache@v2
25-
with:
26-
path: ~/.m2/repository
27-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28-
restore-keys: |
29-
${{ runner.os }}-maven-
30-
31-
- name: Set release version
32-
run: |
33-
VERSION=${{ github.event.inputs.version }}
34-
./mvnw versions:set -DnewVersion=$VERSION
35-
36-
- name: Build
37-
run: ./mvnw --no-transfer-progress -B --file pom.xml process-resources
3813

39-
- name: Deploy
40-
uses: peaceiris/actions-gh-pages@v3
41-
with:
42-
github_token: ${{ secrets.GIT_ACCESS_TOKEN }}
43-
publish_dir: ./target/generated-docs
14+
jobs:
15+
publish:
16+
name: Publish
17+
uses: redis-field-engineering/redis-github-workflows/.github/workflows/publish-maven.yml@main
18+
with:
19+
branch: ${{ github.event.inputs.branch }}
20+
version: ${{ github.event.inputs.version }}
21+
secrets:
22+
github-token: ${{ secrets.GIT_ACCESS_TOKEN }}

.github/workflows/release.yml

Lines changed: 30 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -4,101 +4,38 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: "Release version"
7+
description: 'Release version'
88
required: true
9-
ref:
10-
description: "Branch, tag or SHA to checkout"
11-
required: false
9+
branch:
10+
description: 'Branch'
1211
default: 'master'
12+
required: true
13+
1314
jobs:
1415
release:
1516
name: Release
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v3
20-
with:
21-
ref: ${{ github.event.inputs.ref }}
22-
fetch-depth: 0
23-
24-
- name: Set up Java
25-
uses: actions/setup-java@v3
26-
with:
27-
distribution: zulu
28-
java-version: 11
29-
30-
- uses: actions/cache@v2
31-
with:
32-
path: ~/.m2/repository
33-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
34-
restore-keys: |
35-
${{ runner.os }}-maven-
36-
37-
- name: Set release version
38-
run: |
39-
VERSION=${{ github.event.inputs.version }}
40-
./mvnw versions:set -DnewVersion=$VERSION
41-
42-
- name: Build
43-
run: ./mvnw --no-transfer-progress -B --file pom.xml verify
44-
45-
- name: Show Reports
46-
uses: actions/upload-artifact@v3
47-
if: failure()
48-
with:
49-
name: reports-${{ runner.os }}
50-
path: target/
51-
52-
- name: Release
53-
uses: jreleaser/release-action@v1
54-
env:
55-
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
56-
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
57-
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
58-
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY}}
59-
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
60-
JRELEASER_SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
61-
62-
- name: Commit release version
63-
run: |
64-
VERSION=${{ github.event.inputs.version }}
65-
sed -i -e "s/^\:project-version\:\ \ \ .*/:project-version: $VERSION/g" README.adoc
66-
git add pom.xml
67-
git add README.adoc
68-
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
69-
git config --global user.name "GitHub Action"
70-
git commit -a -m "Releasing version $VERSION"
71-
git push origin ${{ github.event.inputs.ref }}
72-
73-
- name: JReleaser output
74-
if: always()
75-
uses: actions/upload-artifact@v3
76-
with:
77-
name: artifact
78-
path: |
79-
out/jreleaser/trace.log
80-
out/jreleaser/output.properties
81-
82-
- name: Set up QEMU
83-
uses: docker/setup-qemu-action@v2
84-
85-
- name: Set up Docker Buildx
86-
uses: docker/setup-buildx-action@v2
87-
88-
- name: Login to DockerHub
89-
uses: docker/login-action@v2
90-
with:
91-
username: ${{ secrets.DOCKER_USERNAME }}
92-
password: ${{ secrets.DOCKER_PASSWORD }}
93-
94-
- name: Build and push
95-
uses: docker/build-push-action@v3
96-
with:
97-
push: ${{ github.event_name != 'pull_request' }}
98-
tags: fieldengineering/redis-kafka-connect:latest,fieldengineering/redis-kafka-connect:${{ github.event.inputs.version }}
99-
100-
- name: Deploy
101-
uses: peaceiris/actions-gh-pages@v3
102-
with:
103-
github_token: ${{ secrets.GIT_ACCESS_TOKEN }}
104-
publish_dir: ./target/generated-docs
17+
uses: redis-field-engineering/redis-github-workflows/.github/workflows/release-maven.yml@main
18+
with:
19+
branch: ${{ github.event.inputs.branch }}
20+
version: ${{ github.event.inputs.version }}
21+
publish: true
22+
secrets:
23+
github-token: ${{ secrets.GIT_ACCESS_TOKEN }}
24+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
25+
gpg-public-key: ${{ secrets.GPG_PUBLIC_KEY }}
26+
gpg-secret-key: ${{ secrets.GPG_SECRET_KEY }}
27+
docker-username: ${{ secrets.DOCKER_USERNAME }}
28+
docker-password: ${{ secrets.DOCKER_PASSWORD }}
29+
sonatype-username: ${{ secrets.SONATYPE_USERNAME }}
30+
sonatype-password: ${{ secrets.SONATYPE_PASSWORD }}
31+
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
32+
33+
docker:
34+
name: 'Docker'
35+
uses: redis-field-engineering/redis-github-workflows/.github/workflows/docker.yml@main
36+
with:
37+
tags: fieldengineering/redis-kafka-connect:latest,fieldengineering/redis-kafka-connect:${{ github.event.inputs.version }}
38+
secrets:
39+
github-token: ${{ secrets.GIT_ACCESS_TOKEN }}
40+
docker-username: ${{ secrets.DOCKER_USERNAME }}
41+
docker-password: ${{ secrets.DOCKER_PASSWORD }}

0 commit comments

Comments
 (0)