-
Notifications
You must be signed in to change notification settings - Fork 13
98 lines (81 loc) · 2.5 KB
/
Copy pathrelease.yml
File metadata and controls
98 lines (81 loc) · 2.5 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
name: Build and Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
# Set version from tag
- name: Set version from tag
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
mvn versions:set -DnewVersion=${TAG_VERSION} -DgenerateBackupPoms=false
# Run tests
- name: Run tests
run: mvn test
# Build and deploy to Maven Central
- name: Build and deploy to Maven Central
run: mvn -B clean deploy -DskipTests -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# Upload the JAR as a release asset
- name: Upload JAR to GitHub Releases
uses: softprops/action-gh-release@v1
with:
files: target/TestingBotTunnel-*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
- name: Set version from tag
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=${TAG_VERSION}" >> $GITHUB_ENV
mvn versions:set -DnewVersion=${TAG_VERSION} -DgenerateBackupPoms=false
- name: Build JAR
run: mvn -B package -DskipTests
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
testingbot/tunnel:${{ env.VERSION }}
testingbot/tunnel:latest