Merge pull request #119 from madhead/issues/116 #138
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: Master | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build-mini-app: | |
name: Build Mini App | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: 'mini-app/.nvmrc' | |
- run: yarn install | |
working-directory: mini-app | |
- run: yarn run build | |
working-directory: mini-app | |
- run: tar -cvf mini-app.tar mini-app/build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mini-app | |
path: | | |
mini-app.tar | |
build-backend: | |
name: Build backend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: gradle/wrapper-validation-action@v1 | |
- uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: clean :launcher:fly:installDist | |
cache-read-only: ${{ github.ref != 'refs/heads/master' }} | |
- run: tar -cvf backend.tar launcher/fly/build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: backend | |
path: | | |
backend.tar | |
deploy-flyio: | |
name: Fly.io deployment | |
runs-on: ubuntu-latest | |
needs: | |
- build-mini-app | |
- build-backend | |
environment: | |
name: fly.io | |
url: https://tyzenhaus.fly.dev | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: madhead/read-java-properties@latest | |
id: project-version | |
with: | |
file: gradle.properties | |
property: version | |
- uses: madhead/semver-utils@latest | |
id: version | |
with: | |
version: ${{ steps.project-version.outputs.value }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: mini-app | |
- uses: actions/download-artifact@v3 | |
with: | |
name: backend | |
- run: | | |
tar xvf mini-app.tar | |
tar xvf backend.tar | |
mv mini-app/build launcher/fly/build/mini-app | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/build-push-action@v3 | |
with: | |
context: launcher/fly | |
push: true | |
tags: > | |
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}, | |
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}, | |
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.major }}, | |
ghcr.io/${{ github.repository }}:latest | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: >- | |
flyctl deploy | |
--app tyzenhaus | |
--config launcher/fly/fly.toml | |
--image ghcr.io/${{ github.repository }}:${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }} | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- run: >- | |
curl | |
-X POST | |
https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/setWebhook | |
--header "Content-Type: application/json" | |
--data '{ "url": "https://tyzenhaus.fly.dev/${{ secrets.TELEGRAM_BOT_TOKEN }}" }' |