This repository was archived by the owner on Sep 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (86 loc) · 3.34 KB
/
build.yml
File metadata and controls
94 lines (86 loc) · 3.34 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
name: build-sinclude
on: push
jobs:
check_branch:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.check_step.outputs.branch }}
reponame: ${{ steps.check_step.outputs.reponame }}
tag: ${{ steps.check_step.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get branch name, etc.
id: check_step
run: |
raw=${{ github.repository }}
reponame=${raw##*/}
echo "reponame=$reponame" >> $GITHUB_OUTPUT
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo "branch=$branch" >> $GITHUB_OUTPUT
tag=""
if [ ${{ github.ref_type }} = "tag" ]; then
tag=${{ github.ref_name }}
echo "Running in $reponame on $branch for $tag"
else
echo "Running in $reponame on $branch"
fi
echo "tag=$tag" >> $GITHUB_OUTPUT
build-and-deploy:
runs-on: ubuntu-latest
needs: check_branch
env:
HAVE_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN != '' }}
HAVE_GPGKEYURI: ${{ secrets.ACCESS_TOKEN != '' && secrets.GPGKEYURI != '' }}
CIWORKFLOW: yes
CI_SHA1: ${{ github.sha }}
CI_BUILD_NUM: ${{ github.run_number }}
CI_PROJECT_USERNAME: ${{ github.repository_owner }}
CI_PROJECT_REPONAME: ${{ needs.check_branch.outputs.reponame }}
CI_BRANCH: ${{ needs.check_branch.outputs.branch }}
CI_TAG: ${{ needs.check_branch.outputs.tag }}
BEARER: ${{ secrets.SONATYPE_TOKEN }}
steps:
- name: Checkout the branch
uses: actions/checkout@v3
- name: Build
run: |
./gradlew -PsaxonVersion=10.9 clean test
./gradlew -PsaxonVersion=11.7 clean test
./gradlew -PsaxonVersion=12.8 clean test
./gradlew clean dist website
- name: Publish to Sonatype
if: ${{ env.HAVE_GPGKEYURI == 'true' && env.CI_BRANCH == 'master' && env.CI_TAG != '' }}
run: |
curl -s -o secret.gpg ${{ secrets.GPGKEYURI }}
./gradlew -PsonatypePassword="${{ secrets.SONATYPEPASS }}" \
-Psigning.keyId="${{ secrets.SIGNKEY }}" \
-Psigning.password="${{ secrets.SIGNPSW }}" \
-Psigning.secretKeyRingFile=./secret.gpg \
mavenReleaseArtifact
rm -f secret.gpg
curl --header "Authorization: Bearer ${BEARER}" --form bundle=@build/distributions/maven-sinclude-${CI_TAG}.zip https://central.sonatype.com/api/v1/publisher/upload
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# limit-access-to-actor: true
- name: Deploy master to gh-pages
if: ${{ env.HAVE_ACCESS_TOKEN == 'true' && env.CI_BRANCH == 'master' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/website
token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
target-folder: /
- name: Publish tagged release
uses: softprops/action-gh-release@v1
if: ${{ env.HAVE_ACCESS_TOKEN == 'true' && env.CI_BRANCH == 'master' && env.CI_TAG != '' }}
with:
draft: false
prerelease: false
fail_on_unmatched_files: true
files: |
build/distributions/sinclude-${{ env.CI_TAG }}.zip