forked from shazam/fork
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 2.58 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
74
name: Release droidherd-fork
on:
release:
types: [created, workflow_dispatch]
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_LOGIN }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
DOCKER_REPOSITORY: ${{secrets.DOCKER_REPOSITORY}}
DOCKER_IMAGE_NAME: droidherd-fork
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: publish -Psigning.secretKeyRingFile=/tmp/secring.gpg
env:
RELEASE_REPOSITORY_URL: 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:
RELEASE_REPOSITORY_URL: 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 . --file ./OssDockerfile --build-arg FORK_VERSION=$BUILD_VERSION --tag $DOCKER_REPOSITORY/$DOCKER_IMAGE_NAME:$BUILD_VERSION
docker push $DOCKER_REPOSITORY/$DOCKER_IMAGE_NAME:$BUILD_VERSION
docker tag $DOCKER_REPOSITORY/$DOCKER_IMAGE_NAME:$BUILD_VERSION $DOCKER_REPOSITORY/$DOCKER_IMAGE_NAME:latest
echo "Update latest tag $DOCKER_REPOSITORY/$DOCKER_IMAGE_NAME"
docker push $DOCKER_REPOSITORY/$DOCKER_IMAGE_NAME:latest