Skip to content

Commit

Permalink
Full release on github
Browse files Browse the repository at this point in the history
  • Loading branch information
joodie committed Oct 25, 2023
1 parent d54afed commit 0eff3c6
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 46 deletions.
90 changes: 82 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,74 @@
name: Build artifacts
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-SNAPSHOT
push

jobs:
checks:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with: { path: "~/.m2", key: "${{ runner.os }}-${{ hashFiles('deps.edn') }}-m2" }
- uses: actions/cache@v3
with:
key: "clojure-${{ runner.os }}-${{ hashFiles('.github/workflows/install-binaries.sh') }}"
path: |
./bin
./lib
- name: Install clj runtime
run: .github/workflows/install-binaries.sh

- name: Run tests on Clojure
run: bin/clojure -M:test

- name: Run tests on Babashka
run: bin/bb -Sdeps '{:deps {lambdaisland/kaocha {:mvn/version "RELEASE"}}}' -m kaocha.runner/-main

- name: Check dependency freshness
run: bin/clojure -M:outdated

- name: Run linters
run: bin/clojure -M:clj-kondo --lint src test

- name: Install NVD clojure
run: bin/clojure -Ttools install nvd-clojure/nvd-clojure '{:mvn/version "RELEASE"}' :as nvd;

- name: Check NVD
run: bin/clojure -J-Dclojure.main.report=stderr -Tnvd nvd.task/check :classpath \""$(bin/clojure -Spath)\""

create_release:
if: startsWith(github.ref, 'refs/tags/v0') || startsWith(github.ref, 'refs/tags/v1')
runs-on: ubuntu-latest

steps:
- name: version
# need some shenanigans to get simple tag name from repo/tags/tagname ref
run: echo "::set-output name=version::$(echo $GITHUB_REF | cut -d / -f 3)"
id: version

- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ github.token }}

outputs:
# ensure dependent workflows can now get version as
# `needs.release_version.outputs.version`
version: ${{ steps.version.outputs.version }}

build_artifacts:
needs:
- create_release
runs-on: ubuntu-latest

strategy:
matrix:
arch:
Expand All @@ -17,8 +79,6 @@ jobs:
- windows-amd64.zip
- standalone.jar

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
Expand All @@ -30,8 +90,22 @@ jobs:
./bin
./lib
- name: Artifact name
run: echo ::set-output filename=eduhub-validator-${{ needs.create_release.outputs.version }}-${{ matrix.arch }}
id: artifact

- name: Install clj runtime
run: .github/workflows/install-binaries.sh

- name: Build artifact
run: make eduhub-validator-$(echo $GITHUB_REF | cut -d / -f 3)-${{ matrix.arch }} BB=bin/bb
run: make ${{ steps.artifact.outputs.filename }} BB=bin/bb

- name: Upload artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.artifact.outputs.filename }}
asset_name: ${{ steps.artifact.outputs.filename }}
asset_content_type: application/octet-stream
38 changes: 0 additions & 38 deletions .github/workflows/test.yml

This file was deleted.

0 comments on commit 0eff3c6

Please sign in to comment.