Skip to content

Commit

Permalink
set caches, set cli version (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
zenlor authored Aug 23, 2023
1 parent 3f3dfb9 commit 9473052
Show file tree
Hide file tree
Showing 5 changed files with 1,982 additions and 16 deletions.
53 changes: 38 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ on:
workflow_dispatch:
push:
branches:
- "**"
- "github-action"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"
- "master"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: prepare java
uses: actions/setup-java@v3
Expand All @@ -26,21 +24,46 @@ jobs:
java-version: 17

- name: prepare clojure
uses: DeLaGuardo/[email protected]
uses: DeLaGuardo/[email protected]
with:
cli: 'latest'

# Optional step:
- name: cache clojure dependencies
uses: actions/cache@v3
with:
cli: '1.11.1'
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: cljdeps-${{ hashFiles('deps.edn') }}
restore-keys: cljdeps-

- name: build uberjar
id: uberjar
run: |
clj -X:build uber
VERSION=$(clojure -X:build get-version)
TARGET=$(clojure -X:build uber-target)
echo "target=${TARGET}" >> $GITHUB_OUTPUT
echo "filename=$(basename ${TARGET})" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
clojure -X:build uber
mkdir -p /tmp/release
cp bot.jar /tmp/release/bot.jar
cp ${TARGET} /tmp/release/
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: release
path: /tmp/release/bot.jar
if-no-files-found: error
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.ref_name }}
version: ${{ steps.uberjar.outputs.version }}
TARGET: ${{ steps.uberjar.outputs.target }}
run: |
gh release create \
--repo="$GITHUB_REPOSITORY" \
--title="snapshot ${version#v}" \
--generate-notes \
"${version#v}" \
./${TARGET}
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
SOURCES = $(shell find src/ -type f)

deps-lock.json: deps.edn
CLJNIX_ADD_NIX_STORE=true nix run "github:jlesquembre/clj-nix#deps-lock"

bot.jar: deps.edn $(SOURCES)
clj -X:build uber

Expand Down
Loading

0 comments on commit 9473052

Please sign in to comment.