diff --git a/.gitea/workflows/publishRelease.yaml b/.gitea/workflows/publishRelease.yaml new file mode 100644 index 0000000..ebdde11 --- /dev/null +++ b/.gitea/workflows/publishRelease.yaml @@ -0,0 +1,57 @@ +name: Publish tagged release + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest-android + steps: + - name: Checkout the code + uses: actions/checkout@v2 + + - name: Prepare signing + run: | + touch keystore.properties + echo "storePassword=${{ secrets.STOREPASSWORD }}" >> keystore.properties + echo "keyPassword=${{ secrets.KEYPASSWORD }}" >> keystore.properties + echo "keyAlias=key0" >> keystore.properties + echo "storeFile=../AndroidKey" >> keystore.properties + + - name: Generate versionCode + run: | + touch version.properties + let timestamp=$(date +%s)/10 + echo "versionCode=$timestamp" >> version.properties + + - name: Test the app + run: ./gradlew test + + - name: Build apk + run: ./gradlew assembleRelease + + - name: Build abb + run: ./gradlew bundleRelease + + - name: Deploy latest to Nextcloud + run: | + curl -k -u "${{ secrets.NEXTCLOUD_USERNAME }}:${{ secrets.NEXTCLOUD_PASSWORD }}" -T "app/build/outputs/apk/release/app-release.apk" "https://nextcloud.zobrist.me/remote.php/dav/files/deploy/TichuCounter/latest/app-release.apk" + curl -k -u "${{ secrets.NEXTCLOUD_USERNAME }}:${{ secrets.NEXTCLOUD_PASSWORD }}" -T "app/build/outputs/bundle/release/app-release.aab" "https://nextcloud.zobrist.me/remote.php/dav/files/deploy/TichuCounter/latest/app-release.aab" + + - name: Release + id: use-go-action + uses: https://gitea.com/actions/release-action@main + with: + files: |- + app/build/outputs/apk/release/app-release.apk + app/build/outputs/bundle/release/app-release.aab + api_key: '${{secrets.RELEASE_TOKEN}}' + + - uses: https://github.com/ravsamhq/notify-slack-action@v2 + if: always() + with: + status: ${{ job.status }} # required + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required \ No newline at end of file