Skip to content

Commit

Permalink
add build actions
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Sep 2, 2022
1 parent 39d76a5 commit ba95f19
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
category-template: '### $TITLE'
categories:
- title: '🚀 Features'
label: 'feature'
- title: '🐛 Bug Fixes'
label: 'bug'
- title: '🧰 Maintenance'
label: 'chore'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&'
exclude-labels:
- 'skip-changelog'
version-resolver:
major:
labels:
- 'semver:major'
minor:
labels:
- 'semver:minor'
patch:
labels:
- 'semver:patch'
default: minor
template: |
Changes in this release:
$CHANGES
33 changes: 33 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
"schedule:weekly",
],
"labels": [
"chore"
],
"rebaseWhen": "conflicted",
"packageRules": [
{
"groupName": "GitHub Actions",
"matchPaths": [
".github/**",
],
},
{
"groupName": "Kotlin & Dokka",
"matchPackagePrefixes": [
"org.jetbrains.kotlin",
"org.jetbrains.dokka",
],
},
{
"groupName": "Compose & Accompanist",
"matchPackageNames": [
"androidx.compose",
"com.google.accompanist",
],
}
]
}
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build

on:
pull_request:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Assemble & Linters
run: ./gradlew :demo:assembleDebug lint lintKotlin
- uses: yutailang0119/[email protected]
name: App Lint errors to annotations
if: ${{ failure() }}
continue-on-error: true # lint may be ok
with:
xml_path: app/build/reports/lint-results-debug.xml
- uses: yutailang0119/[email protected]
name: Lib Lint errors to annotations
if: ${{ failure() }}
continue-on-error: true # lint may be ok
with:
xml_path: lib/build/reports/lint-results-debug.xml
- name: KTLint errors to annotations
if: ${{ failure() }}
run: |
jq --raw-output '[.[] | ({ f: .file } + ( .errors[] | { l: .line, c: .column, m: .message, r: .rule } )) | "::error file=core/\(.f),line=\(.l),col=\(.c)::\(.m) [\(.r)]" ] | join("\n")' core/build/reports/ktlint/main-lint.json || true
jq --raw-output '[.[] | ({ f: .file } + ( .errors[] | { l: .line, c: .column, m: .message, r: .rule } )) | "::error file=demo/\(.f),line=\(.l),col=\(.c)::\(.m) [\(.r)]" ] | join("\n")' demo/build/reports/ktlint/main-lint.json || true
40 changes: 40 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release Drafter

on:
push:
branches:
- main

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
persist-credentials: false
- run: |
TAG_NAME="${{ steps.create_release.outputs.tag_name }}"
VERSION_NAME="${TAG_NAME:1}"
sed -i "s/VERSION_NAME=[0-9]\+.[0-9]\+.[0-9]\+/VERSION_NAME=$VERSION_NAME/g" gradle.properties
if git diff --exit-code; then
echo "::set-output name=changes_exist::false"
else
echo "::set-output name=changes_exist::true"
echo "::set-output name=VERSION_NAME::$VERSION_NAME"
fi
id: version_job
- name: Commit and push files
if: ${{ steps.version_job.outputs.changes_exist == 'true' }}
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.GH_ACTION_DEPLOY_PRIVATE_KEY }}"
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Bump version to ${{ steps.version_job.outputs.VERSION_NAME }}" -a
git push [email protected]:$GITHUB_REPOSITORY.git
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
release:
types: [ published ]

jobs:
release:
name: Release
runs-on: ubuntu-latest
env:
TERM: dumb
steps:
- uses: actions/checkout@v3
- name: set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Decrypt secrets
run: |
echo ${{ secrets.ENCRYPT_KEY }} | release/signing-unpack.sh
mv gradle.properties gradle.backup.properties
cat gradle.backup.properties | grep -v configuration-cache > gradle.properties
- name: Deploy to Sonatype
run: |
./gradlew publish --no-parallel --stacktrace
./gradlew closeAndReleaseRepository
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
- name: Build AAB & APK
run: |
./gradlew :demo:bundleRelease :demo:assembleRelease
- name: Upload APK to release
uses: softprops/action-gh-release@v1
id: release
with:
files: |
core/build/outputs/apk/release/core-release.apk
- name: Clean secrets
if: always()
run: release/signing-cleanup.sh

0 comments on commit ba95f19

Please sign in to comment.