Skip to content

Github Actions - Export Kotlin Files #22

Github Actions - Export Kotlin Files

Github Actions - Export Kotlin Files #22

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Generate Kotlin
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
upload-kotlin-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: List directory structure before building
run: ls -R
- name: Generate Protos
run: ./gradlew generateProtos
- name: List directory structure after building
run: ls -R
- name: List generated Kotlin files for debugging
run: ls -R lib/build/generated/source/wire/
- name: Upload generated Kotlin files
uses: actions/upload-artifact@v4
with:
name: generated-kotlin-files
path: lib/build/generated/source/wire/**/*.kt
- name: Push to 'ksharma-xyz/Kotlin-Proto' repo
uses: actions/checkout@v4
with:
repository: 'ksharma-xyz/Kotlin-Proto' # Target repo
token: ${{ secrets.TOKEN }} # Use secret for authentication
- name: Configure Git
run: |
git config user.name 'Karan Sharma'
git config user.email '[email protected]'
git config --global init.defaultBranch main
- name: Create a new branch
run: |
git checkout -b kotlin
- name: Change to lib directory
run: cd lib
- name: Create Commit
run: |
git add .
git commit -m "Add generated Kotlin files from main project"
working-directory: lib
- name: Push changes to target repo
run: git push origin ${{ steps.checkout-target-repo.outputs.branch }}
working-directory: lib