-
Notifications
You must be signed in to change notification settings - Fork 22
86 lines (81 loc) · 2.7 KB
/
build-branch.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
name: build-specs
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 "::set-output name=reponame::$reponame"
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo "::set-output name=branch::$branch"
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 "::set-output name=tag::$tag"
build-and-deploy:
runs-on: ubuntu-latest
needs: check_branch
env:
HAVE_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN != '' }}
BRANCH_NAME: ${{ github.ref_name }}
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 }}
steps:
- name: Checkout the ixml repository
uses: actions/checkout@v3
- name: Build
run: |
./gradlew dist
- name: Publish release
uses: softprops/action-gh-release@v1
if: ${{ env.HAVE_ACCESS_TOKEN == 'true' && env.CI_BRANCH == 'main' && env.CI_TAG != '' }}
with:
draft: false
prerelease: false
fail_on_unmatched_files: true
files: |
build/distributions/*-${{ env.CI_TAG }}.zip
# FIXME: automate deploy to CDN for tagged builds
## Remember the SHA of the current build.
#SHA=$(git rev-parse --verify HEAD)
#
## Checkout and update cdn.docbook.org; note we need to explicitly
## specify the deployment key because it's a different repo.
#IDRSA="/home/circleci/.ssh/id_rsa_b0bdc42f3808364c081793c898531e98"
#
#cd ../
#mkdir cdn
#cd cdn
#git clone --depth 1 -c core.sshCommand="/usr/bin/ssh -i $IDRSA" git@github.com:docbook/cdn.git .
#
## This assumes the same tag will never be republished (it never should be!).
#rsync -ar ../repo/build/stage/ schema/
#
## generate indexes
#perl bin/make-indexes.pl schema
#
#git add .
#git commit -m "Deploy DocBook ${CIRCLE_TAG} for ${CIRCLE_PROJECT_USERNAME}: ${SHA}"
#git push -q origin HEAD