Skip to content

Commit 9e73100

Browse files
authored
Merge pull request #23 from ndw/fix-ci
Switch to GitHub actions for CI
2 parents 0c09122 + a1637f9 commit 9e73100

File tree

3 files changed

+121
-78
lines changed

3 files changed

+121
-78
lines changed

.circleci/config.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.

.github/workflows/branch.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: build-branch
2+
on: push
3+
4+
jobs:
5+
check_branch:
6+
runs-on: ubuntu-latest
7+
outputs:
8+
branch: ${{ steps.check_step.outputs.branch }}
9+
reponame: ${{ steps.check_step.outputs.reponame }}
10+
tag: ${{ steps.check_step.outputs.tag }}
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Get branch name, etc.
18+
id: check_step
19+
run: |
20+
raw=${{ github.repository }}
21+
reponame=${raw##*/}
22+
echo "reponame=$reponame" >> $GITHUB_OUTPUT
23+
raw=$(git branch -r --contains ${{ github.ref }})
24+
branch=${raw##*/}
25+
echo "branch=$branch" >> $GITHUB_OUTPUT
26+
tag=""
27+
if [ ${{ github.ref_type }} = "tag" ]; then
28+
tag=${{ github.ref_name }}
29+
echo "Running in $reponame on $branch for $tag"
30+
else
31+
echo "Running in $reponame on $branch"
32+
fi
33+
echo "tag=$tag" >> $GITHUB_OUTPUT
34+
35+
build-and-deploy:
36+
runs-on: ubuntu-latest
37+
needs: check_branch
38+
env:
39+
HAVE_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN != '' }}
40+
CIWORKFLOW: yes
41+
CI_SHA1: ${{ github.sha }}
42+
CI_BUILD_NUM: ${{ github.run_number }}
43+
CI_PROJECT_USERNAME: ${{ github.repository_owner }}
44+
CI_PROJECT_REPONAME: ${{ needs.check_branch.outputs.reponame }}
45+
CI_BRANCH: ${{ needs.check_branch.outputs.branch }}
46+
CI_TAG: ${{ needs.check_branch.outputs.tag }}
47+
48+
steps:
49+
- name: Checkout the branch
50+
uses: actions/checkout@v3
51+
52+
- name: Build
53+
run: |
54+
./gradlew dist
55+
56+
- name: Publish release
57+
uses: softprops/action-gh-release@v1
58+
if: ${{ env.HAVE_ACCESS_TOKEN == 'true' && env.CI_BRANCH == 'main' && env.CI_TAG != '' }}
59+
with:
60+
draft: false
61+
prerelease: false
62+
fail_on_unmatched_files: true
63+
files: |
64+
build/dist/xmlresolverdata-${{ env.CI_TAG }}.zip

.github/workflows/pr.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: build-pr
2+
on:
3+
pull_request_target:
4+
types: [assigned, opened, edited, synchronize, reopened]
5+
branches:
6+
- main
7+
8+
jobs:
9+
check_branch:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
branch: ${{ steps.check_step.outputs.branch }}
13+
reponame: ${{ steps.check_step.outputs.reponame }}
14+
tag: ${{ steps.check_step.outputs.tag }}
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Get branch name, etc.
22+
id: check_step
23+
run: |
24+
raw=${{ github.repository }}
25+
reponame=${raw##*/}
26+
echo "reponame=$reponame" >> $GITHUB_OUTPUT
27+
raw=$(git branch -r --contains ${{ github.ref }})
28+
branch=${raw##*/}
29+
echo "branch=$branch" >> $GITHUB_OUTPUT
30+
tag=""
31+
if [ ${{ github.ref_type }} = "tag" ]; then
32+
tag=${{ github.ref_name }}
33+
echo "Running in $reponame on $branch for $tag"
34+
else
35+
echo "Running in $reponame on $branch"
36+
fi
37+
echo "tag=$tag" >> $GITHUB_OUTPUT
38+
39+
build-and-deploy:
40+
runs-on: ubuntu-latest
41+
needs: check_branch
42+
env:
43+
CIWORKFLOW: yes
44+
CI_SHA1: ${{ github.sha }}
45+
CI_BUILD_NUM: ${{ github.run_number }}
46+
CI_PROJECT_USERNAME: ${{ github.repository_owner }}
47+
CI_PROJECT_REPONAME: ${{ needs.check_branch.outputs.reponame }}
48+
CI_BRANCH: ${{ needs.check_branch.outputs.branch }}
49+
CI_TAG: ${{ needs.check_branch.outputs.tag }}
50+
51+
steps:
52+
- name: Checkout the branch
53+
uses: actions/checkout@v3
54+
55+
- name: Build
56+
run: |
57+
./gradlew dist

0 commit comments

Comments
 (0)