Skip to content

Commit

Permalink
CF-99: Separate docs per version (#504)
Browse files Browse the repository at this point in the history
* updates the output directory for dokka to include the version number

* added index.html file to redirect to the latest version

* update sed command so it correctly replaces multiple instances of the string if present

* removed .bck file because we don't use it

* fix link to docs in index.html

* updated dokka to latest version

* adding back the .bck because I broke things accidentally

* revert unnecessary indent
  • Loading branch information
aboedo authored Mar 9, 2022
1 parent 37c0147 commit 417eacd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ jobs:
command: sudo pip install awscli
- run:
name: Deploy to S3
command: aws s3 sync ~/purchases-android/docs s3://purchases-docs/android --delete
command: aws s3 sync ~/purchases-android/docs/5.1.0-SNAPSHOT s3://purchases-docs/android/5.1.0-SNAPSHOT --delete
- run:
name: Update index.html
command: aws s3 cp ~/purchases-android/docs/index.html s3://purchases-docs/android/index.html
- run:
name: Invalidate CloudFront caches
command: aws cloudfront create-invalidation --distribution-id EPTW7F3CB566V --paths "/*"
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,8 @@ fastlane/report.xml
integration-tests/keystore

# share settings
!/.idea/codeStyles/
!/.idea/codeStyles/

# index.html is used to redirect to the latest docs version
# when navigating to root
!/docs/index.html
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buildscript {
classpath "com.vanniktech:gradle-maven-publish-plugin:0.15.1"
classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.32"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.6.10"
}
}

Expand Down Expand Up @@ -75,6 +75,6 @@ task detektAllBaseline(type: io.gitlab.arturbosch.detekt.DetektCreateBaselineTas
apply plugin: 'org.jetbrains.dokka'

tasks.dokkaHtmlMultiModule.configure {
outputDirectory.set(file("docs"))
outputDirectory.set(file("docs/" + project.property("VERSION_NAME")))
includes.from("README.md")
}
8 changes: 8 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=https://sdk.revenuecat.com/android/5.1.0/index.html" />
</head>
<body>
</body>
</html>
4 changes: 3 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ platform :android do
previous_version = android_get_version_name(gradle_file: gradle_file_path)
android_set_version_name(version_name: new_version, gradle_file: gradle_file_path)
increment_version_in(previous_version, new_version, '../common/src/main/java/com/revenuecat/purchases/common/Config.kt')
increment_version_in(previous_version, new_version, '../.circleci/config.yml')
increment_version_in(previous_version, new_version, '../docs/index.html')
increment_version_in(previous_version, new_version, '../gradle.properties')
end

Expand Down Expand Up @@ -176,7 +178,7 @@ platform :android do
end

def increment_version_in(previous_version, new_version, path)
sed_regex = 's/' + previous_version + '/' + new_version + '/'
sed_regex = 's/' + previous_version + '/' + new_version + '/g'
backup_extension = '.bck'
sh "sed -i'#{backup_extension}' #{sed_regex} #{path}"
end
Expand Down

0 comments on commit 417eacd

Please sign in to comment.