-
Notifications
You must be signed in to change notification settings - Fork 3
130 lines (114 loc) · 3.91 KB
/
Copy pathci_master.yml
File metadata and controls
130 lines (114 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: "Release"
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8
- name: Restore local Maven repository from cache
uses: actions/cache@v4
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: '2025.07.28'
- name: Lint
run: clj-kondo --lint src test
test:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8
- name: Restore local Maven repository from cache
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
restore-keys: |
${{ runner.os }}-maven-
- name: Install Leiningen
run: |
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod +x lein
sudo mv lein /usr/local/bin/
lein version
- name: Unit tests
env:
IP_STACK_ACCESS_KEY: ${{ secrets.IP_STACK_ACCESS_KEY }}
run: lein test
deploy:
needs: test
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8
- name: Restore local Maven repository from cache
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
restore-keys: |
${{ runner.os }}-maven-
- name: Install Leiningen
run: |
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod +x lein
sudo mv lein /usr/local/bin/
lein version
- 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 0
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