Skip to content

Merge pull request #31 from sol-sh/optionaly #30

Merge pull request #31 from sol-sh/optionaly

Merge pull request #31 from sol-sh/optionaly #30

Workflow file for this run

name: "Release"
on:
push:
branches:
- master
jobs:
build:
uses: ./.github/workflows/build.yml
test:
needs: build
uses: ./.github/workflows/test.yml
deploy:
needs: test
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 8
- name: Restore local Maven repository from cache
uses: actions/cache@v3
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 ORIGINAL_VERSION=$(less pom.xml | grep "<version>" | head -1 | cut -d ">" -f2 | cut -d "<" -f1)
echo "Original version is:" $ORIGINAL_VERSION
lein change version leiningen.release/bump-version release
lein do vcs commit, install
lein pom
export RELEASE_VERSION=$(less pom.xml | grep "<version>" | head -1 | cut -d ">" -f2 | cut -d "<" -f1)
echo "Release version is:" $RELEASE_VERSION
if [[ !("$RELEASE_VERSION" =~ $RELEASE_REGEX) ]]
then
echo "Version isn't a release version:" $RELEASE_VERSION ", skipping deployment to Clojars..."
exit 1
fi
lein deploy
echo "Release version:" $RELEASE_VERSION"; commit: "${{github.sha}}"; successfully deployed to Clojars"
git tag -a $RELEASE_VERSION -m "Release version $RELEASE_VERSION"
git push origin master