Skip to content

Commit 897f028

Browse files
authored
Merge pull request #94 from Backblaze/kyle/artifactory
Configure to deploy to Artifactory and cleanup GitHub Actions configs
2 parents 1f63ef6 + 2bcd7b5 commit 897f028

File tree

3 files changed

+34
-42
lines changed

3 files changed

+34
-42
lines changed

.github/workflows/.ci_cd.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ env:
1414
OUTPUT_DIR: $GITHUB_WORKSPACE/build/outputs
1515
OUTPUT_ZIP: b2-sdk-build-${GITHUB_RUN_NUMBER}.zip
1616
BUILD_NUMBER: ${{ github.run_number }}
17-
# This token was generated under rhryckewicz account
18-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1917
# These are stored in Bitwarden
2018
B2_ACCOUNT_ID: ${{ secrets.B2_ACCOUNT_ID }}
2119
B2_UPLOAD_BUCKET: ${{ secrets.B2_UPLOAD_BUCKET }}
@@ -25,26 +23,26 @@ jobs:
2523
build:
2624
runs-on: ubuntu-latest
2725
steps:
28-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v4
2927
with:
3028
fetch-depth: 0
3129

32-
- name: Use jdk8
33-
uses: actions/setup-java@v2
30+
- uses: actions/setup-java@v4
3431
with:
35-
distribution: 'adopt'
36-
java-version: '8'
37-
cache: 'gradle'
32+
distribution: 'temurin'
33+
java-version: '11'
34+
35+
- uses: gradle/actions/wrapper-validation@v4
36+
- name: Setup Gradle
37+
uses: gradle/actions/setup-gradle@v4
3838

39-
- uses: gradle/wrapper-validation-action@v1
4039
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
41-
uses: actions/setup-python@v2
40+
uses: actions/setup-python@v5
4241
with:
4342
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
4443

4544
- name: Install dependencies
4645
run: |
47-
mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
4846
# upgrade pip and setuptools so that b2 CLI can be properly installed
4947
python -m pip install --upgrade pip setuptools
5048
python -m pip install b2
@@ -66,18 +64,13 @@ jobs:
6664
6765
- name: Deploy to internal Maven repo
6866
if: github.ref == 'refs/heads/master' && github.repository == 'Backblaze/b2-sdk-java-private'
69-
run: $GITHUB_WORKSPACE/gradlew publishMavenPublicationToBzGithubPackagesRepository
67+
run: $GITHUB_WORKSPACE/gradlew publishMavenPublicationToBzArtifactoryRepository publishMavenPublicationToBzGithubPackagesRepository
7068
env:
69+
ORG_GRADLE_PROJECT_bzArtifactoryUsername: ${{ secrets.ARTIFACTORY_USERNAME }}
70+
ORG_GRADLE_PROJECT_bzArtifactoryPassword: ${{ secrets.ARTIFACTORY_TOKEN }}
7171
ORG_GRADLE_PROJECT_bzGithubPackagesUsername: ${{ secrets.PACKAGES_USERNAME }}
7272
ORG_GRADLE_PROJECT_bzGithubPackagesPassword: ${{ secrets.PACKAGES_TOKEN }}
7373

74-
- name: Cleanup Gradle Cache
75-
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
76-
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
77-
run: |
78-
rm -f ~/.gradle/caches/modules-2/modules-2.lock
79-
rm -fr ~/.gradle/caches/*/plugin-resolution/
80-
8174
- name: Upload to b2
8275
if: github.ref == 'refs/heads/master'
8376
# upload to b2 (if credentials are provided, as they will be for backblaze's builds, but not pull requests)
@@ -86,16 +79,16 @@ jobs:
8679

8780
- name: Check GitHub Pages status
8881
if: github.ref == 'refs/heads/master'
89-
uses: crazy-max/ghaction-github-status@v2
82+
uses: crazy-max/ghaction-github-status@v4
9083
with:
9184
pages_threshold: major_outage
9285

93-
- name: Deploy
86+
- name: Deploy Javadoc
9487
# note that i'm only uploading the javadocs for b2-sdk-core.
9588
# that's because i'm lame and building separate javadocs for
9689
# each jar and only uploading one set of javadocs.
9790
if: github.ref == 'refs/heads/master' && success()
98-
uses: crazy-max/ghaction-github-pages@v2
91+
uses: crazy-max/ghaction-github-pages@v3
9992
with:
10093
target_branch: gh-pages
10194
build_dir: core/build/docs/javadoc

.github/workflows/deploy.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ jobs:
1212
if: github.repository == 'Backblaze/b2-sdk-java'
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
1818

19-
- name: Use jdk8
20-
uses: actions/setup-java@v2
19+
- uses: actions/setup-java@v4
2120
with:
22-
distribution: 'adopt'
23-
java-version: '8'
24-
cache: 'gradle'
21+
distribution: 'temurin'
22+
java-version: '11'
23+
24+
- uses: gradle/actions/wrapper-validation@v4
25+
- name: Setup Gradle
26+
uses: gradle/actions/setup-gradle@v4
2527

26-
- uses: gradle/wrapper-validation-action@v1
2728
- name: Deploy to Maven Central
2829
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository createBundle --no-daemon --stacktrace
2930
env:
@@ -33,21 +34,15 @@ jobs:
3334
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
3435
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
3536

36-
- name: Cleanup Gradle Cache
37-
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
38-
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
39-
run: |
40-
rm -f ~/.gradle/caches/modules-2/modules-2.lock
41-
rm -fr ~/.gradle/caches/*/plugin-resolution/
42-
4337
- name: Get tag name
4438
id: get_tag
4539
shell: bash
4640
run: |
4741
tag_name="$(echo $GITHUB_REF | cut -d / -f 3)"
4842
echo ::set-output name=tag::$tag_name
43+
4944
- name: Create GitHub Release
50-
uses: softprops/action-gh-release@v1
45+
uses: softprops/action-gh-release@v2
5146
env:
5247
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5348
with:

buildSrc/src/main/kotlin/b2sdk.gradle.kts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ publishing {
9090
groupId = project.group.toString()
9191
artifactId = project.name
9292

93-
if (System.getenv("RELEASE_BUILD") != null) {
94-
version = project.version.toString()
93+
version = if (System.getenv("RELEASE_BUILD") != null) {
94+
project.version.toString()
9595
} else {
96-
version = when (val buildNum = System.getenv("BUILD_NUMBER")) {
96+
when (val buildNum = System.getenv("BUILD_NUMBER")) {
9797
null -> project.version.toString()
9898
else -> "${project.version}+$buildNum"
9999
}
@@ -134,6 +134,10 @@ publishing {
134134
}
135135

136136
repositories {
137+
maven("https://artifactory.backblaze.com/artifactory/maven-private/") {
138+
name = "bzArtifactory"
139+
credentials(PasswordCredentials::class)
140+
}
137141
maven("https://maven.pkg.github.com/Backblaze/repo") {
138142
name = "bzGithubPackages"
139143
credentials(PasswordCredentials::class)
@@ -144,8 +148,8 @@ publishing {
144148
val sonatypeUsername = findProperty("sonatypeUsername")
145149
val sonatypePassword = findProperty("sonatypePassword")
146150

147-
val gpgSigningKey = System.getenv("GPG_SIGNING_KEY")
148-
val gpgPassphrase = System.getenv("GPG_PASSPHRASE")
151+
val gpgSigningKey: String? = System.getenv("GPG_SIGNING_KEY")
152+
val gpgPassphrase: String? = System.getenv("GPG_PASSPHRASE")
149153

150154
if (sonatypeUsername != null && sonatypePassword != null) {
151155
signing {

0 commit comments

Comments
 (0)