-
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (117 loc) · 4.71 KB
/
walter-cd.yml
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
# This file is maintained by Walter CI, and may be rewritten.
# https://github.com/piotr-yuxuan/walter-ci
#
# You are free to remove this project from Walter CI realm by opening
# a PR. You may also create another workflow besides this one.
name: Walter CD
'on':
repository_dispatch: null
workflow_dispatch:
inputs:
walter-version:
description: Walter bin version
required: false
type: string
version-to-release:
description: Version to release
required: false
type: string
push:
branches: '**'
env:
GIT_ASKPASS: ${HOME}/.walter-ci/bin/askpass.sh
GIT_AUTHOR_EMAIL: ${{ secrets.WALTER_GIT_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.WALTER_AUTHOR_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.WALTER_GIT_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.WALTER_AUTHOR_NAME }}
GIT_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
VERSION_TO_RELEASE: ${{ github.event.inputs.version-to-release }}
WALTER_ACTOR: ${{ secrets.WALTER_ACTOR }}
WALTER_CLOJARS_PASSWORD: ${{ secrets.WALTER_CLOJARS_PASSWORD }}
WALTER_CLOJARS_USERNAME: ${{ secrets.WALTER_CLOJARS_USERNAME }}
WALTER_GITHUB_PASSWORD: ${{ secrets.WALTER_GITHUB_PASSWORD }}
WALTER_VERSION: ${{ github.event.inputs.walter-version }}
jobs:
run-tests:
runs-on: ubuntu-latest
name: Run tests
steps:
- uses: piotr-yuxuan/walter-ci@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: lein with-profile +walter/kaocha,+kaocha run -m kaocha.runner --skip-meta :slow --skip-meta :perf
release-artifacts:
runs-on: ubuntu-latest
name: Release artifacts
if: ${{ github.event.inputs.version-to-release != '' }}
needs:
- run-tests
steps:
- uses: piotr-yuxuan/walter-ci@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set project version to ${{ github.event.inputs.version-to-release }}
run: |-
VERSION_FILE=$(ls resources/*.version)
echo ${VERSION_TO_RELEASE} > ${VERSION_FILE}
git add ${VERSION_FILE}
- run: lein uberjar
- run: lein with-profile uberjar pom
- run: git diff --staged --exit-code
continue-on-error: true
id: diff
- run: git commit -m "Version ${VERSION_TO_RELEASE}" -m "[skip ci]"
if: steps.diff.outcome == 'failure'
- run: git tag -a ${VERSION_TO_RELEASE} -m "Version ${VERSION_TO_RELEASE}"
if: steps.diff.outcome == 'failure'
- run: git push --follow-tags
if: steps.diff.outcome == 'failure'
- run: tree -Chup .
- uses: softprops/action-gh-release@fe9a9bd3295828558c7a3c004f23f3bf77d155b2
with:
generate_release_notes: true
tag_name: ${{ github.event.inputs.version-to-release }}
draft: false
prerelease: false
fail_on_unmatched_files: true
files: ./target/**-standalone.jar
- name: Deploy on Clojars?
id: target-clojars
run: lein pprint :deploy-repositories | bb --stream -I --eval '(System/exit (if (contains? (into {} *input*) (first *command-line-args*)) 0 1))' "clojars"
continue-on-error: true
- name: lein deploy clojars
if: steps.target-clojars.outcome == 'success'
run: walter retry
env:
WALTER_TRY: lein deploy clojars
- name: Deploy on GitHub?
id: target-github
run: lein pprint :deploy-repositories | bb --stream -I --eval '(System/exit (if (contains? (into {} *input*) (first *command-line-args*)) 0 1))' "github"
continue-on-error: true
- name: lein deploy github
if: 'false'
run: walter retry
env:
WALTER_TRY: lein deploy github
- name: Build cljdoc ahead of the first visitor
run: |-
PROJECT_GROUP=$(lein pprint --no-pretty -- :group)
PROJECT_NAME=$(lein pprint --no-pretty -- :name)
curl 'https://cljdoc.org/api/request-build2' \
-X POST \
-H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0" \
-H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8" \
-H "Accept-Language: en-US,en;q=0.5" \
-H "Accept-Encoding: gzip, deflate, br" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Origin: https://cljdoc.org" \
-H "DNT: 1" \
-H "Connection: keep-alive" \
-H "Referer: https://cljdoc.org/d/${PROJECT_GROUP}/${PROJECT_NAME}/${VERSION_TO_RELEASE}" \
-H "Upgrade-Insecure-Requests: 1" \
-H "Sec-Fetch-Dest: document" \
-H "Sec-Fetch-Mode: navigate" \
-H "Sec-Fetch-Site: same-origin" \
-H "Sec-Fetch-User: ?1" \
-H "TE: trailers" \
--data-raw "project=${PROJECT_GROUP}%2F${PROJECT_NAME}&version=${VERSION_TO_RELEASE}"