Skip to content

Merge pull request #22 from clj-codes/feat/adds-github-login #5

Merge pull request #22 from clj-codes/feat/adds-github-login

Merge pull request #22 from clj-codes/feat/adds-github-login #5

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: 'adopt'
java-version: '11'
- name: Install clojure cli
uses: DeLaGuardo/setup-clojure@master
with:
cli: 1.11.1.1435
- 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:dev: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: 'adopt'
java-version: '11'
- name: Install clojure cli
uses: DeLaGuardo/setup-clojure@master
with:
cli: 1.11.1.1435
- 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
deploy:
runs-on: ubuntu-latest
needs: [run_tests, build_jar]
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
# --ha=false because by default fly.io spins two machines for high availability
- run: flyctl deploy --remote-only --ha=false
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}