Skip to content

Commit 4e14363

Browse files
committed
Fix documentation upload
Resolves #1191
1 parent 5dbb3f6 commit 4e14363

File tree

2 files changed

+35
-61
lines changed

2 files changed

+35
-61
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ on:
1010

1111
jobs:
1212

13-
# build and test, then upload logs if failure
1413
build:
1514
runs-on: ubuntu-latest
16-
1715
steps:
1816
- uses: actions/[email protected]
1917
- name: Spring Gradle Build Action
@@ -22,39 +20,10 @@ jobs:
2220
java-version: '17'
2321
distribution: 'temurin'
2422
- name: Build with Gradle
25-
run: ./gradlew build
26-
- name: Tar Build Logs
27-
if: ${{ failure() }}
28-
run: |
29-
mkdir -p build
30-
tar \
31-
-zc \
32-
--ignore-failed-read \
33-
--file build/buildlogs.tar.gz \
34-
*/build/reports \
35-
*/*/build/reports
36-
- name: Upload Build Logs
37-
if: ${{ failure() }}
38-
uses: actions/[email protected]
39-
with:
40-
name: buildlogs
41-
path: build/buildlogs.tar.gz
23+
run: ./gradlew -Dmaven.repo.local=$(pwd)/deployment-repository clean build distZip publishToMavenLocal
4224

43-
# if build job succeed, build without tests and publish
44-
publish:
45-
needs: build
46-
runs-on: ubuntu-latest
47-
steps:
48-
- uses: actions/[email protected]
49-
- name: Spring Gradle Build Action
50-
uses: spring-io/spring-gradle-build-action@v2
51-
with:
52-
java-version: '17'
53-
distribution: 'temurin'
54-
- name: Build with Gradle
55-
run: ./gradlew -Dmaven.repo.local=$(pwd)/deployment-repository -x test clean build publishToMavenLocal
56-
57-
- name: Deploy
25+
- name: Deploy artefacts
26+
if: ${{ github.repository == 'spring-projects/spring-statemachine' && github.ref_name == 'main' }}
5827
uses: spring-io/[email protected]
5928
with:
6029
uri: 'https://repo.spring.io'
@@ -63,3 +32,27 @@ jobs:
6332
build-name: 'spring-statemachine-main'
6433
repository: 'libs-snapshot-local'
6534
folder: 'deployment-repository'
35+
36+
- name: Deploy documentation
37+
if: ${{ github.repository == 'spring-projects/spring-statemachine' && github.ref_name == 'main' }}
38+
env:
39+
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
40+
DOCS_SSH_HOST_KEY: ${{ secrets.DOCS_SSH_HOST_KEY }}
41+
DOCS_HOST: ${{ secrets.DOCS_HOST }}
42+
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
43+
DOCS_PATH: ${{ secrets.DOCS_PATH }}
44+
run: |
45+
mkdir "$HOME/.ssh"
46+
echo "$DOCS_SSH_KEY" > "$HOME/.ssh/key"
47+
chmod 600 "$HOME/.ssh/key"
48+
echo "$DOCS_SSH_HOST_KEY" > "$HOME/.ssh/known_hosts"
49+
50+
PROJECT_VERSION=$(cat gradle.properties | grep "version=" | cut -d '=' -f 2)
51+
ssh -i $HOME/.ssh/key $DOCS_USERNAME@$DOCS_HOST "cd $DOCS_PATH && mkdir -p $PROJECT_VERSION"
52+
53+
pushd build
54+
scp -i $HOME/.ssh/key -r api $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$PROJECT_VERSION
55+
popd
56+
pushd docs/build/docs
57+
scp -i $HOME/.ssh/key -r asciidoc $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$PROJECT_VERSION/reference
58+
popd

.github/workflows/deploy-docs.yml

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,23 @@ jobs:
2525
- name: Build with Gradle
2626
run: ./gradlew -Pversion=$PROJECT_VERSION distZip
2727

28-
- name: Setup SSH key
28+
- name: Deploy documentation
2929
if: ${{ github.repository == 'spring-projects/spring-statemachine' && github.ref_name == 'main' }}
3030
env:
3131
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
3232
DOCS_SSH_HOST_KEY: ${{ secrets.DOCS_SSH_HOST_KEY }}
33+
DOCS_HOST: ${{ secrets.DOCS_HOST }}
34+
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
35+
DOCS_PATH: ${{ secrets.DOCS_PATH }}
3336
run: |
3437
mkdir "$HOME/.ssh"
3538
echo "$DOCS_SSH_KEY" > "$HOME/.ssh/key"
3639
chmod 600 "$HOME/.ssh/key"
3740
echo "$DOCS_SSH_HOST_KEY" > "$HOME/.ssh/known_hosts"
38-
39-
- name: Prepare release directory
40-
if: ${{ github.repository == 'spring-projects/spring-statemachine' && github.ref_name == 'main' }}
41-
env:
42-
DOCS_HOST: ${{ secrets.DOCS_HOST }}
43-
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
44-
run: |
45-
DOCS_PATH="/opt/www/domains/spring.io/docs/htdocs/spring-statemachine/docs"
4641
ssh -i $HOME/.ssh/key $DOCS_USERNAME@$DOCS_HOST "cd $DOCS_PATH && mkdir -p $PROJECT_VERSION"
47-
48-
- name: Deploy Java docs
49-
if: ${{ github.repository == 'spring-projects/spring-statemachine' && github.ref_name == 'main' }}
50-
env:
51-
DOCS_HOST: ${{ secrets.DOCS_HOST }}
52-
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
53-
working-directory: build
54-
run: |
55-
DOCS_PATH="/opt/www/domains/spring.io/docs/htdocs/spring-statemachine/docs"
42+
pushd build
5643
scp -i $HOME/.ssh/key -r api $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$PROJECT_VERSION
57-
58-
- name: Deploy reference docs
59-
if: ${{ github.repository == 'spring-projects/spring-statemachine' && github.ref_name == 'main' }}
60-
env:
61-
DOCS_HOST: ${{ secrets.DOCS_HOST }}
62-
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
63-
working-directory: docs/build/docs
64-
run: |
65-
DOCS_PATH="/opt/www/domains/spring.io/docs/htdocs/spring-statemachine/docs"
44+
popd
45+
pushd docs/build/docs
6646
scp -i $HOME/.ssh/key -r asciidoc $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$PROJECT_VERSION/reference
47+
popd

0 commit comments

Comments
 (0)