Skip to content

Commit 4e32fef

Browse files
authored
Merge pull request #2 from auth0/feat/add-ci-pipeline
Feat: Added github actions and workflows and publish scripts
2 parents e757b69 + 86a4d27 commit 4e32fef

File tree

22 files changed

+687
-323
lines changed

22 files changed

+687
-323
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Return a boolean indicating if the version contains prerelease identifiers
2+
3+
inputs:
4+
version:
5+
required: true
6+
7+
outputs:
8+
prerelease:
9+
value: ${{ steps.get_prerelease.outputs.PRERELEASE }}
10+
11+
runs:
12+
using: composite
13+
14+
steps:
15+
- id: get_prerelease
16+
shell: bash
17+
run: |
18+
if [[ "${VERSION}" == *"beta"* || "${VERSION}" == *"alpha"* ]]; then
19+
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
20+
else
21+
echo "PRERELEASE=false" >> $GITHUB_OUTPUT
22+
fi
23+
env:
24+
VERSION: ${{ inputs.version }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Return the release notes extracted from the body of the PR associated with the release.
2+
3+
inputs:
4+
version:
5+
required: true
6+
repo_name:
7+
required: false
8+
repo_owner:
9+
required: true
10+
token:
11+
required: true
12+
13+
outputs:
14+
release-notes:
15+
value: ${{ steps.get_release_notes.outputs.RELEASE_NOTES }}
16+
17+
runs:
18+
using: composite
19+
20+
steps:
21+
- uses: actions/github-script@v7
22+
id: get_release_notes
23+
with:
24+
result-encoding: string
25+
script: |
26+
const { data: pulls } = await github.rest.pulls.list({
27+
owner: process.env.REPO_OWNER,
28+
repo: process.env.REPO_NAME,
29+
state: 'all',
30+
head: `${process.env.REPO_OWNER}:release/${process.env.VERSION}`,
31+
});
32+
core.setOutput('RELEASE_NOTES', pulls[0].body);
33+
env:
34+
GITHUB_TOKEN: ${{ inputs.token }}
35+
REPO_OWNER: ${{ inputs.repo_owner }}
36+
REPO_NAME: ${{ inputs.repo_name }}
37+
VERSION: ${{ inputs.version }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Return the version extracted from the branch name
2+
3+
outputs:
4+
version:
5+
value: ${{ steps.get_version.outputs.VERSION }}
6+
7+
runs:
8+
using: composite
9+
10+
steps:
11+
- id: get_version
12+
shell: bash
13+
run: |
14+
VERSION=$(head -1 .version)
15+
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish release to Java
2+
3+
inputs:
4+
java-version:
5+
required: true
6+
ossr-username:
7+
required: true
8+
ossr-token:
9+
required: true
10+
signing-key:
11+
required: true
12+
signing-password:
13+
required: true
14+
15+
runs:
16+
using: composite
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Java
23+
shell: bash
24+
run: |
25+
curl -s "https://get.sdkman.io" | bash
26+
source "/home/runner/.sdkman/bin/sdkman-init.sh"
27+
sdk list java
28+
sdk install java ${{ inputs.java-version }} && sdk default java ${{ inputs.java-version }}
29+
30+
- uses: gradle/actions/wrapper-validation@v5
31+
32+
- name: Publish Packages to Maven
33+
shell: bash
34+
run: ./gradlew publishToSonatype closeSonatypeStagingRepository -PisSnapshot=false --stacktrace
35+
env:
36+
MAVEN_USERNAME: ${{ inputs.ossr-username }}
37+
MAVEN_PASSWORD: ${{ inputs.ossr-token }}
38+
SIGNING_KEY: ${{ inputs.signing-key }}
39+
SIGNING_PASSWORD: ${{ inputs.signing-password }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Create a GitHub release
2+
3+
inputs:
4+
token:
5+
required: true
6+
files:
7+
required: false
8+
name:
9+
required: true
10+
body:
11+
required: true
12+
tag:
13+
required: true
14+
commit:
15+
required: true
16+
draft:
17+
default: false
18+
required: false
19+
prerelease:
20+
default: false
21+
required: false
22+
fail_on_unmatched_files:
23+
default: true
24+
required: false
25+
26+
runs:
27+
using: composite
28+
29+
steps:
30+
- uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
31+
with:
32+
body: ${{ inputs.body }}
33+
name: ${{ inputs.name }}
34+
tag_name: ${{ inputs.tag }}
35+
target_commitish: ${{ inputs.commit }}
36+
draft: ${{ inputs.draft }}
37+
prerelease: ${{ inputs.prerelease }}
38+
fail_on_unmatched_files: ${{ inputs.fail_on_unmatched_files }}
39+
files: ${{ inputs.files }}
40+
env:
41+
GITHUB_TOKEN: ${{ inputs.token }}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: "Reversing Labs Scanner"
2+
description: "Runs the Reversing Labs scanner on a specified artifact."
3+
inputs:
4+
artifact-path:
5+
description: "Path to the artifact to be scanned."
6+
required: true
7+
version:
8+
description: "Version of the artifact."
9+
required: true
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.10"
18+
19+
- name: Install Python dependencies
20+
shell: bash
21+
run: |
22+
pip install boto3 requests
23+
24+
- name: Configure AWS credentials
25+
uses: aws-actions/configure-aws-credentials@v1
26+
with:
27+
role-to-assume: ${{ env.PRODSEC_TOOLS_ARN }}
28+
aws-region: us-east-1
29+
mask-aws-account-id: true
30+
31+
- name: Install RL Wrapper
32+
shell: bash
33+
run: |
34+
pip install rl-wrapper>=1.0.0 --index-url "https://${{ env.PRODSEC_TOOLS_USER }}:${{ env.PRODSEC_TOOLS_TOKEN }}@a0us.jfrog.io/artifactory/api/pypi/python-local/simple"
35+
36+
- name: Run RL Scanner
37+
shell: bash
38+
env:
39+
RLSECURE_LICENSE: ${{ env.RLSECURE_LICENSE }}
40+
RLSECURE_SITE_KEY: ${{ env.RLSECURE_SITE_KEY }}
41+
SIGNAL_HANDLER_TOKEN: ${{ env.SIGNAL_HANDLER_TOKEN }}
42+
PYTHONUNBUFFERED: 1
43+
run: |
44+
if [ ! -f "${{ inputs.artifact-path }}" ]; then
45+
echo "Artifact not found: ${{ inputs.artifact-path }}"
46+
exit 1
47+
fi
48+
49+
rl-wrapper \
50+
--artifact "${{ inputs.artifact-path }}" \
51+
--name "${{ github.event.repository.name }}" \
52+
--version "${{ inputs.version }}" \
53+
--repository "${{ github.repository }}" \
54+
--commit "${{ github.sha }}" \
55+
--build-env "github_actions" \
56+
--suppress_output
57+
58+
# Check the outcome of the scanner
59+
if [ $? -ne 0 ]; then
60+
echo "RL Scanner failed."
61+
echo "scan-status=failed" >> $GITHUB_ENV
62+
exit 1
63+
else
64+
echo "RL Scanner passed."
65+
echo "scan-status=success" >> $GITHUB_ENV
66+
fi
67+
68+
outputs:
69+
scan-status:
70+
description: "The outcome of the scan process."
71+
value: ${{ env.scan-status }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Return a boolean indicating if a tag already exists for the repository
2+
3+
inputs:
4+
token:
5+
required: true
6+
tag:
7+
required: true
8+
9+
outputs:
10+
exists:
11+
description: "Whether the tag exists or not"
12+
value: ${{ steps.tag-exists.outputs.EXISTS }}
13+
14+
runs:
15+
using: composite
16+
17+
steps:
18+
- id: tag-exists
19+
shell: bash
20+
run: |
21+
GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/${TAG_NAME}"
22+
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s -H "Authorization: token ${GITHUB_TOKEN}")
23+
if [ "$http_status_code" -ne "404" ] ; then
24+
echo "EXISTS=true" >> $GITHUB_OUTPUT
25+
else
26+
echo "EXISTS=false" >> $GITHUB_OUTPUT
27+
fi
28+
env:
29+
TAG_NAME: ${{ inputs.tag }}
30+
GITHUB_TOKEN: ${{ inputs.token }}

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
8+
- package-ecosystem: "gradle"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"
12+
ignore:
13+
- dependency-name: "*"
14+
update-types: ["version-update:semver-major"]

.github/workflows/build-and-test.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,25 @@ jobs:
1010
gradle:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v6
1414
- uses: actions/setup-java@v5
1515
with:
1616
distribution: temurin
1717
java-version: 17
1818

1919
- name: Set up Gradle
20-
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
20+
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
2121

2222
- name: Test and Assemble with Gradle
2323
run: ./gradlew assemble check --continue --console=plain
2424

25-
- uses: actions/upload-artifact@v4
25+
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
26+
with:
27+
flags: unittests
28+
29+
- uses: actions/upload-artifact@v5
2630
with:
2731
name: Reports
2832
path: |
29-
packages/auth0-api-java/build/reports/
30-
packages/auth0-springboot-api/build/reports/
33+
auth0-api-java/build/reports/
34+
auth0-springboot-api/build/reports/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "Validate Gradle Wrapper"
2+
on: [pull_request]
3+
4+
jobs:
5+
validation:
6+
name: "validation/gradlew"
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v6
10+
- uses: gradle/actions/wrapper-validation@v5

0 commit comments

Comments
 (0)