Skip to content

Merge pull request #28 from sol-sh/optionaly #28

Merge pull request #28 from sol-sh/optionaly

Merge pull request #28 from sol-sh/optionaly #28

Workflow file for this run

name: "Release"
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 8
- name: Restore local Maven repository from cache
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup linter
uses: DeLaGuardo/setup-clj-kondo@master
with:
version: '2021.06.18'
- name: Lint
run: clj-kondo --lint src
test:
needs: build
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 8
- name: Restore local Maven repository from cache
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
restore-keys: |
${{ runner.os }}-maven-
- name: Generate proto files
run: lein protodeps generate
- name: Unit tests
env:
IP_STACK_ACCESS_KEY: ${{ secrets.IP_STACK_ACCESS_KEY }}
run: lein cloverage --html --lcov --junit
- name: Publish Unit Test Results
uses: EnricoMi/[email protected]
#if: always()
if: false
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "target/coverage/junit.xml"
- name: Coveralls
uses: coverallsapp/github-action@master
if: false
with:
path-to-lcov: "target/coverage/lcov.info"
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy:
needs: test
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 8
- name: Restore local Maven repository from cache
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
restore-keys: |
${{ runner.os }}-maven-
- name: Deploy release version
env:
RELEASE_REGEX: ^[0-9]{1,2}[.][0-9]{1,2}[.][0-9]{1,3}$
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
run: |
git config --global user.name "github-actions-bot"
git config --global user.email "<>"
git config --global push.followTags true
lein pom
export VERSION=$(grep "<version>" pom.xml | head -1 | cut -d ">" -f2 | cut -d "<" -f1)
echo "version is:" $VERSION
if [[ !("$VERSION" =~ $RELEASE_REGEX) ]]
then
echo "Version isn't a release version:" $VERSION ", skipping deployment to Clojars..."
exit 0
fi
lein deploy
echo "Release version:" $VERSION"; commit: "${{github.sha}}"; successfully deployed to Clojars"
export TAG_NAME="v$VERSION"
git tag -a -m "Version $VERSION" $TAG_NAME
git push origin $TAG_NAME