Github Actions - Export Kotlin Files #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Generate Protos | |
run: ./gradlew generateProtos | |
- name: List all files in the build directory for debugging | |
run: find build -type f | |
- name: List generated Kotlin files for debugging | |
run: ls -R build/generated/source/wire/ | |
- name: Upload generated Kotlin files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: generated-kotlin-files | |
path: 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: 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 }} |