Skip to content

Commit

Permalink
Remove GITHUB_TOKEN, build with Gradle configuration (#2796)
Browse files Browse the repository at this point in the history
* Remove GITHUB_TOKEN, build with gradle configuration

* Encode PAT
  • Loading branch information
seabornlee authored Sep 1, 2022
1 parent 5746c1e commit d04e1ed
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
architecture: arm64

- name: Run unit tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sh ./build.sh

- name: Upload Test Reports Folder
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:

- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ jobs:
lint:
name: Comments lint result on PR
runs-on: macos-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- name: set up JDK
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ jobs:
lint:
name: Run Lint
runs-on: macos-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- name: Set up JDK
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ task printVersionCode {
gradle.projectsEvaluated({
def username = getGitHubUsername()
def password = getPAT()
def isOnCI = System.getenv("GITHUB_TOKEN")
if (!isOnCI && (!username || !password)) {
if (!username || !password) {
throw new GradleException('Please provide GitHub username and Personal Access Token. Find more here https://github.com/alphaWallet/alpha-wallet-android#getting-started')
}
})

// GitHub Personal Access Token
private String getPAT() {
project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
def encodedToken = project.findProperty("gpr.key")
new String(encodedToken.decodeBase64())
}

private String getGitHubUsername() {
Expand Down
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ android.useAndroidX=true
org.gradle.jvmargs=-Xms2048m -Xmx4096m
android.suppressUnsupportedCompileSdk=32

# You should replace these with your own generated PAT, please see the Readme.md
# Base64 Encoded GitHub PAT,
# Make sure only check read:packages and read:user permissions if you want to create your own PAT,
# and encode it with Base64 encoder https://www.base64encoder.io/
gpr.user=smarttokenlabs@hotmail.com
gpr.key=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
gpr.key=Z2hwX3NFR09PbXRkOFQ2M09RcEdmY0xvR1VXTVJ6ODJBSDAxWWQ4OA==

0 comments on commit d04e1ed

Please sign in to comment.