Merge branch 'develop' of https://github.com/aymenbs2/AymoAi into dev… #37
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
name: Build and Publish Plugin | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set up Kotlin | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Create config.properties file | |
run: | | |
echo "AYMOAPI_KEY=${{ secrets.AYMOAPI_KEY }}" >> src/main/resources/config.properties | |
echo "BASE_URL=${{ secrets.BASE_URL }}" >> config.properties | |
echo "HELPFUL_ASSISTANT=${{ secrets.HELPFUL_ASSISTANT }}" >> src/main/resources/config.properties | |
echo "REFACTOR_CODE_RQ=${{ secrets.REFACTOR_CODE_RQ }}" >> src/main/resources/config.properties | |
echo "MODEL=${{ secrets.MODEL }}" >> config.properties | |
echo "GENERATE_UNIT_TEST_RQ=${{ secrets.GENERATE_UNIT_TEST_RQ }}" >> src/main/resources/config.properties | |
echo "REFACTOR_SELECTED_CODE_RQ=${{ secrets.REFACTOR_SELECTED_CODE_RQ }}" >> src/main/resources/config.properties | |
echo "SCAN_RQ=${{ secrets.SCAN_RQ }}" >> src/main/resources/config.properties | |
echo "SCAN_ROLE=${{ secrets.SCAN_ROLE }}" >> src/main/resources/config.properties | |
- name: Download certificate chain file | |
run: echo "${{ secrets.AYMOAI_CHAIN }}" > $GITHUB_WORKSPACE/certificate_chain.pem | |
- name: Download private key file | |
run: echo "${{ secrets.AYMOAI_CERTIF }}" > $GITHUB_WORKSPACE/private_key.pem | |
- name: Make version increment script executable | |
run: chmod +x ./increment_version.sh | |
- name: Increment version | |
id: increment_version | |
run: | | |
new_version=$(./increment_version.sh) | |
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV | |
- name: Update version in build.gradle.kts | |
run: | | |
sed -i "s/version = \".*\"/version = \"$NEW_VERSION\"/" build.gradle.kts | |
- name: Commit version bump | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git add build.gradle.kts | |
git commit -m "Bump version to $NEW_VERSION" | |
git tag $NEW_VERSION | |
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/aymenbs2/AymoAi.git --tags | |
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/aymenbs2/AymoAi.git | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Create zip artifact | |
run: | | |
zip -r artifact.zip . -x ".git/*" | |
- name: Upload zip artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-artifact | |
path: artifact.zip | |
# - name: Sign Plugin | |
#env: | |
# AYMOAI_PASS: ${{ secrets.AYMOAI_PASS }} | |
# AYMOAI_TOCKEN: ${{ secrets.AYMOAI_TOCKEN }} | |
# run: ./gradlew signPlugin publishPlugin |