-
Notifications
You must be signed in to change notification settings - Fork 3
73 lines (60 loc) · 2.46 KB
/
release.yml
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
name: Release Droidherd
on:
release:
types: [created, workflow_dispatch]
env:
MVN_LOGIN: ${{ secrets.NEXUS_LOGIN }}
MVN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
DOCKER_REPOSITORY: ${{secrets.DOCKER_REPOSITORY}}
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check repository and tag
run: .github/scripts/release-env-check.sh
- name: Set build version
run: |
echo "BUILD_VERSION=$(echo $GITHUB_REF_NAME | grep -Eo '[0-9]\.[0-9]+\.[0-9]+')" >> $GITHUB_ENV
- name: Show and check version
run: |
echo "Evaluated version: [$BUILD_VERSION]"
if [[ -z "$BUILD_VERSION" ]]; then exit 1; fi
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Build
run: ./gradlew assemble test
- name: Generate sign key for publishing
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
SIGN_OSSRH_GRADLE_PROPERTIES: ${{ secrets.SIGN_OSSRH_GRADLE_PROPERTIES }}
run: |
echo "$GPG_KEY" | base64 --decode > /tmp/secring.gpg
mkdir -p ~/.gradle
echo -en "$SIGN_OSSRH_GRADLE_PROPERTIES" > ~/.gradle/gradle.properties
- name: Execute Gradle publish
uses: gradle/gradle-build-action@v2
with:
arguments: :api:publish -Psigning.secretKeyRingFile=/tmp/secring.gpg
env:
MVN_RELEASE_REPOSITORY: https://oss.sonatype.org/service/local/staging/deploy/maven2/
- name: Execute Gradle nexus staging release
uses: gradle/gradle-build-action@v2
with:
arguments: closeAndReleaseRepository
env:
MVN_RELEASE_REPOSITORY: https://oss.sonatype.org/service/local/
- name: Docker build and push
run: |
echo '${{ secrets.DOCKER_REPOSITORY_PASSWORD }}' | docker login -u $DOCKER_REPOSITORY --password-stdin
docker build ./app --file ./app/OssDockerfile --tag $DOCKER_REPOSITORY/droidherd:${BUILD_VERSION}
docker push $DOCKER_REPOSITORY/droidherd:${BUILD_VERSION}
docker tag $DOCKER_REPOSITORY/droidherd:${BUILD_VERSION} $DOCKER_REPOSITORY/droidherd:latest
echo "Update latest tag $DOCKER_REPOSITORY/droidherd"
docker push $DOCKER_REPOSITORY/droidherd:latest