Skip to content

Merge pull request #23 from rafaeldelboni/refact/jdk-21 #22

Merge pull request #23 from rafaeldelboni/refact/jdk-21

Merge pull request #23 from rafaeldelboni/refact/jdk-21 #22

Workflow file for this run

name: Deploy
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
run_tests:
strategy:
matrix:
namespace: [ unit, integration ]
operating-system: [ubuntu-latest]
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Install clojure cli
uses: DeLaGuardo/setup-clojure@master
with:
cli: 1.11.3.1463
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }}
restore-keys: ${{ runner.os }}-m2
- name: Execute clojure code
run: clojure -M:test ${{ matrix.namespace }}
build_jar:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Install clojure cli
uses: DeLaGuardo/setup-clojure@master
with:
cli: 1.11.3.1463
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }}
restore-keys: ${{ runner.os }}-m2
- name: Generate uberjar
run: clojure -T:build uberjar
- name: Upload uberjar artifact
uses: actions/upload-artifact@v4
with:
name: built-uberjar
path: target/service.jar
retention-days: 1
update-telegram-commands:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Babashka
uses: turtlequeue/setup-babashka@v1.7.0
with:
babashka-version: 1.3.189
- name: Updates Webhook url
run: bb ./scripts/telegram-upsert-webhook-and-commands.bb.clj --update-webhook
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_BOT_WEBHOOK: ${{ secrets.TELEGRAM_BOT_WEBHOOK }}
- name: Updates Slash Commands in Discord
run: bb ./scripts/telegram-upsert-webhook-and-commands.bb.clj --update-cmd
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_BOT_WEBHOOK: ${{ secrets.TELEGRAM_BOT_WEBHOOK }}
- name: List Current state of Slash Commands in Discord
run: bb ./scripts/telegram-upsert-webhook-and-commands.bb.clj --list-cmd
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_BOT_WEBHOOK: ${{ secrets.TELEGRAM_BOT_WEBHOOK }}
update-discord-slash-commands:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Babashka
uses: turtlequeue/setup-babashka@v1.7.0
with:
babashka-version: 1.3.189
- name: Updates Slash Commands in Discord
run: bb ./scripts/discord-upsert-slash-commands.bb.clj --update
env:
DISCORD_APP_ID: ${{ secrets.DISCORD_APP_ID }}
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
- name: List Current state of Slash Commands in Discord
run: bb ./scripts/discord-upsert-slash-commands.bb.clj --list
env:
DISCORD_APP_ID: ${{ secrets.DISCORD_APP_ID }}
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
deploy:
runs-on: ubuntu-latest
needs: [run_tests, build_jar, update-discord-slash-commands, update-telegram-commands]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download uberjar artifact
uses: actions/download-artifact@v4
with:
name: built-uberjar
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}