-
Notifications
You must be signed in to change notification settings - Fork 7
92 lines (83 loc) · 2.59 KB
/
ci.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
name: CI
on:
push:
branches:
- main
- 'v*'
pull_request: {}
schedule:
- cron: '0 3 * * *' # daily, at 3am
jobs:
test:
name: Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v1
with:
submodules: true
token: ${{ github.token }}
- uses: actions/setup-java@v2.3.1
with:
java-version: '17'
distribution: 'zulu'
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: chmod +x ./gradlew
- run: ./gradlew assemble
- run: ./gradlew check
- name: create changelog and tag
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_COMMIT: ${{ github.sha }}
GITHUB_REPO: ${{ github.repository }}
run: |
version=$(sh ./gradlew -q printVersion)
git fetch --all --tags
TAG=v$version
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "tag exists";
else
export GITHUB_AUTH=$GITHUB_TOKEN
export changelog=$(npx lerna-changelog --repo $GITHUB_REPO --next-version=$version)
sed -i src/main/resources/META-INF/plugin.xml "s/CHANGELOG_PLACEHOLDER/$changelog"
echo -e "# Changelog\n\n$changelog\n$(tail --lines=+2 CHANGELOG.md)" > CHANGELOG.md
git add CHANGELOG.md
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git config --local user.name "$GITHUB_ACTOR"
git commit -m "update changelog"
git tag $TAG
git push
git push --tags
fi
upload:
name: Upload
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: actions/setup-java@v1
with:
java-version: '17'
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: chmod +x ./gradlew
- run: ./gradlew buildPlugin && ls ./build/distributions
- uses: actions/upload-artifact@v2
with:
name: EmberExperimental.zip
path: ./build/distributions/EmberExperimental.js-*.zip