diff --git a/.github/workflows/publish_github_release.yml b/.github/workflows/publish_github_release.yml index 5085218..443117b 100644 --- a/.github/workflows/publish_github_release.yml +++ b/.github/workflows/publish_github_release.yml @@ -5,6 +5,10 @@ on: tags: - '*' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + permissions: contents: write @@ -42,3 +46,43 @@ jobs: generate_release_notes: true draft: true files: app/releaseGithub/pezkuwi-wallet-android-${{ github.ref_name }}-github.apk + + deploy-to-vps: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Download built artifact + uses: actions/download-artifact@v4 + with: + name: apk + path: deploy + + - name: Prepare APK for VPS + run: | + mkdir -p ./vps-deploy + mv deploy/releaseGithub/app-releaseGithub.apk ./vps-deploy/pezkuwi-wallet.apk + + - name: Create version.json + run: | + TAG="${{ github.ref_name }}" + VERSION="${TAG#v}" + cat > ./vps-deploy/version.json << EOF + { + "version": "$VERSION", + "tag": "$TAG", + "apk": "pezkuwi-wallet.apk", + "updated_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)" + } + EOF + + - name: Deploy to VPS + uses: appleboy/scp-action@v1.0.0 + with: + host: ${{ secrets.VPS_HOST }} + username: ${{ secrets.VPS_USER }} + key: ${{ secrets.VPS_SSH_KEY }} + source: 'vps-deploy/*' + target: '/var/www/wallet.pezkuwichain.io' + strip_components: 1 + overwrite: true