Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
stigi committed Oct 11, 2024
1 parent dd302cb commit 6ec04c8
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 97 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ on:
push:
branches:
- main
- ullrich/add-changesets
- ullrich/publish-via-ci

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # allows the action to create a release
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -19,15 +21,16 @@ jobs:
with:
node-version: 20

- uses: bahmutov/npm-install@v1
# - uses: bahmutov/npm-install@v1

- name: Create release PR or publish release
uses: changesets/action@v1
with:
version: yarn changeset version
publish: yarn changeset publish
commit: 'chore: version package'
title: 'chore: version package'
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.BELLA_ACTION_TOKEN }}
run: echo "FAKE - RELEASE"
# uses: changesets/action@v1
# with:
# version: yarn changeset version
# publish: yarn changeset publish
# commit: 'chore: version package'
# title: 'chore: version package'
# createGithubReleases: true
# env:
# GITHUB_TOKEN: ${{ secrets.BELLA_ACTION_TOKEN }}
27 changes: 0 additions & 27 deletions .github/workflows/gradle-dependency-submission.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/gradle-test.yml

This file was deleted.

95 changes: 95 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Gradle Build, Tests and Publish

# Runs on Pull Requests and on the `main` branch after the `changeset` workflow ran (see `publish` job)
on:
workflow_run:
workflows: [ Changeset ]
types:
- completed
pull_request:

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Adding Google Services
env:
DATA: ${{ secrets.GOOGLE_SERVICES }}
run: echo $DATA | base64 -di > ./example/google-services.json

- name: Build with Gradle Wrapper
run: echo "FAKE -- BUILD"
# run: ./gradlew build -xlint


test:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
needs: [ "build" ]
steps:
- name: Test with Gradle Wrapper
run: echo "FAKE -- TEST"
# run: ./gradlew test

# - name: Publish Test Report
# uses: mikepenz/action-junit-report@v4
# if: success() || failure() # always run even if the previous step fails
# with:
# report_paths: '**/build/test-results/test*/TEST-*.xml'

lint:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
needs: [ "build" ]
steps:
- name: Lint with Gradle Wrapper
run: echo "FAKE -- LINT"
# run: ./gradlew lint
# - name: Publish Lint Report
# uses: yutailang0119/action-android-lint@v4
# if: success() || failure() # always run even if the previous step fails
# with:
# report-path: '**/build/reports/lint-results-*.xml'
# ignore-warnings: false
# continue-on-error: false # If annotations contain error of severity, action-android-lint exit 1.



publish:
runs-on: ubuntu-latest
needs: [ "build", "test", "lint" ]
steps:
- name: Publish to Maven
run: echo "FAKE - PUBLISH"

dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write

needs: ["publish"] # only submit dependencies for published releases

steps:
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
run: echo "FAKE - DEPENDENCY SUBMISSION"
# uses: gradle/actions/dependency-submission@v4
# with:
# cache-read-only: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ output.json
# Google Services (e.g. APIs or Firebase)
google-services.json

# Maven publishing secret
publish-mvn.asc

# Android Profiling
*.hprof

Expand Down
17 changes: 9 additions & 8 deletions gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,27 @@ def isReleaseBuild() {
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
return findProperty('RELEASE_REPOSITORY_URL') ?: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://s01.oss.sonatype.org/content/repositories/snapshots/"
return findProperty('SNAPSHOT_REPOSITORY_URL') ?: "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
return findProperty('NEXUS_USERNAME') ?: ""
}

def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
return findProperty('NEXUS_PASSWORD') ?: ""
}

def getGpgKey() {
return hasProperty('SIGNING_KEY') ? SIGNING_KEY : ""
return findProperty('SIGNING_KEY') ?: ""
}

def getGpgPassphrase() {
return hasProperty('PASSPHRASE') ? PASSPHRASE : ""
return findProperty('PASSPHRASE') ?: ""
}

def configurePom(pom) {
Expand Down Expand Up @@ -92,6 +90,9 @@ afterEvaluate { project ->
}

signing {
logger.quiet('A message which is logged at QUIET level ' +
getRepositoryUsername())

required { isReleaseBuild() }
def gpgKey = getGpgKey()
def gpgPassphrase = getGpgPassphrase()
Expand Down
23 changes: 23 additions & 0 deletions scripts/publish-mvn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# make sure the script runs relative to the repo root
set -euo pipefail && cd "$(dirname "${BASH_SOURCE[0]}")/.."

info() { printf "%s\n" "$*" >&1; }
error() { printf "%s\n" "$*" >&2; }
trap 'echo Changeset interrupted >&2; exit 2' INT TERM


info "Publishing via gradle publish task"
ORG_GRADLE_PROJECT_NEXUS_USERNAME="lol-yo" ./gradlew publish \
-Psigning.secretKeyRingFile="../publish-mvn.asc \
-Psigning.keyId="4AE5701C" \
-Psigning.password="A/4DBzp2wAbmnSEip+Erb8Hx3oJckCYdbKxQgsvKE4MZa/iI6usCg2404wcOxPNC"
# NEXUS_USERNAME=josuemontano
# NEXUS_PASSWORD=h5,K/9GC&gQZ;?>C=^:4
# 403DC5174AE5701C
# signing.keyId=4AE5701C
# signing.password=A/4DBzp2wAbmnSEip+Erb8Hx3oJckCYdbKxQgsvKE4MZa/iI6usCg2404wcOxPNC
# signing.secretKeyRingFile=/Users/ullrich/Projects/magicbell-android/foobar.gpg

0 comments on commit 6ec04c8

Please sign in to comment.