Skip to content

Release update

Release update #45

name: Release update
on:
workflow_dispatch:
jobs:
release-update:
runs-on: ubuntu-latest
if: github.repository == 'patrykandpatrick/vico'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
path: vico
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
- uses: gradle/gradle-build-action@v2
- run: |
git config --global user.email "[email protected]"
git config --global user.name "Patryk & Patrick Bot"
git clone https://${{ secrets.BOT_PAT }}@github.com/patrykandpatrick/patrykandpatrick.com
cd ${{ github.workspace }}/vico
VERSION_NAME=$(grep -oP "(?<=version_name).*(?=\",)" versions.gradle | grep -oP "(?<=\").*")
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "TAG_NAME=v$VERSION_NAME" >> $GITHUB_ENV
IS_PRERELEASE=false
echo $VERSION_NAME | grep -q "alpha\|beta" && IS_PRERELEASE=true
echo "IS_PRERELEASE=$IS_PRERELEASE" >> $GITHUB_ENV
./gradlew assembleDebug
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG_NAME }}
token: ${{ secrets.BOT_PAT }}
prerelease: ${{ env.IS_PRERELEASE }}
draft: true
files: ${{ github.workspace }}/vico/sample/build/outputs/apk/debug/*.apk
- run: |
cd ${{ github.workspace }}/vico
git remote set-url origin https://patrykandpatrickbot:${{ secrets.BOT_PAT }}@github.com/patrykandpatrick/vico.git
./gradlew dokkaHtmlMultiModule
API_REFERENCE_DESTINATION=${{ github.workspace }}/patrykandpatrick.com/src/vico/api/$(if $IS_PRERELEASE; then echo $VERSION_NAME; else echo main; fi)
rm -fr $API_REFERENCE_DESTINATION/*
cp -R ${{ github.workspace }}/vico/vico/build/dokka/htmlMultiModule/. $API_REFERENCE_DESTINATION
cd ${{ github.workspace }}/patrykandpatrick.com
git remote set-url origin https://patrykandpatrickbot:${{ secrets.BOT_PAT }}@github.com/patrykandpatrick/patrykandpatrick.com.git
git add src/vico/api
git diff --staged --quiet HEAD || git commit -m "Update Vico API reference"
git push origin
cd ${{ github.workspace }}/vico
git push origin
./gradlew publish
env:
ORG_GRADLE_PROJECT_GPG_KEY: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
ORG_GRADLE_PROJECT_OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}