Skip to content

Commit

Permalink
change
Browse files Browse the repository at this point in the history
  • Loading branch information
ksharma-xyz committed Jul 5, 2024
1 parent 998e6e4 commit fed7f9d
Showing 1 changed file with 35 additions and 30 deletions.
65 changes: 35 additions & 30 deletions .github/workflows/gen-kotlin.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
# 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:
# types: [opened, synchronize, reopened, closed]
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:
generate-kotlin:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout repo
uses: actions/checkout@v4

#- name: List directory structure before building
# run: ls -R
- 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 directory structure after building
run: ls -R

- name: List generated Kotlin files for debugging
run: ls -R lib/build/generated/source/wire/
run: ls -R lib/build/generated/source/wire/ || echo "Directory not found"

- 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
- name: Checkout target repo
uses: actions/checkout@v4
with:
repository: 'ksharma-xyz/Kotlin-Proto' # Target repo
token: ${{ secrets.TOKEN }} # Use secret for authentication
repository: 'ksharma-xyz/Kotlin-Proto'
token: ${{ secrets.TOKEN }}

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: generated-kotlin-files
path: ./generated

- name: List downloaded files
run: ls -R ./generated

- name: Configure Git
run: |
Expand All @@ -53,25 +55,28 @@ jobs:
git config --global init.defaultBranch main
- name: Create a new branch
run: |
git checkout -b kotlin
- name: List directory structure before copying files
run: ls -R
run: git checkout -b kotlin

- name: Copy generated files to target repo
run: |
mkdir -p lib/build/generated/source/wire
cp -r ../Proto-API/lib/build/generated/source/wire/* lib/build/generated/source/wire/
ls -R lib/build/generated/source/wire/ || echo "Copy failed"
- name: List directory structure after copying files
run: ls -R
mkdir -p kotlin
cp -r ./generated/* kotlin/
ls -R kotlin/ || echo "Copy failed"
- name: Create Commit
run: |
git add .
git commit -m "Add generated Kotlin files from main project"
- name: Push changes to target repo
run: git push origin ${{ steps.checkout-target-repo.outputs.branch }}
run: git push origin kotlin

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.TOKEN }}
commit-message: "Add generated Kotlin files from ksharma-xyz/Proto-API"
branch: kotlin
title: "Add generated Kotlin files from main project"
body: "This PR adds the generated Kotlin files from the main project."
base: main

0 comments on commit fed7f9d

Please sign in to comment.