-
Notifications
You must be signed in to change notification settings - Fork 13
60 lines (57 loc) · 2.02 KB
/
main.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
# The default workflow for GitHub Actions that is used for continuous
# integration. A configuration file that is used to control when, where,
# and how different CI jobs are executed.
# For more information on how to modify this file check the following link:
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions
name: CI
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Java 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: liberica
- uses: burrunan/gradle-cache-action@v2
name: Cache .gradle
- name: Build
run: ./gradlew --no-parallel --no-daemon --build-cache build
- name: Publish release
if: ${{ github.ref == 'refs/heads/main' }}
env:
PUSH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git fetch origin refs/heads/release:release
git checkout release
cp cache-action-entrypoint/build/dist/js/productionExecutable/cache-action-entrypoint.js* dist/
git checkout main action.yml
git checkout main action-types.yml
git add dist/ action.yml action-types.yml
if git diff --staged --quiet; then
echo Everything is UP-TO-DATE
else
echo Pushing the new release
git fetch origin 'refs/tags/v*:refs/tags/v*'
if [[ $(git tag --points-at HEAD) ]] || [[ "$(git log --format=%B -n 1 origin/release)" != 'Publish release from'* ]]; then
AMEND=
FORCE=
else
AMEND=--amend
FORCE=--force
fi
git config --global user.email "sitnikov.vladimir@gmail.com"
git config --global user.name "CI"
git commit $AMEND -m "Publish release from $GITHUB_SHA"
remote_repo="https://${GITHUB_ACTOR}:${PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git push $remote_repo $FORCE release
fi