Skip to content

Commit 87f8126

Browse files
committed
added RL changes
1 parent d5c05d7 commit 87f8126

File tree

15 files changed

+492
-10
lines changed

15 files changed

+492
-10
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @auth0/dx-sdks-engineer
1+
* @auth0/project-dx-sdks-engineer-codeowner
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 the version contains prerelease identifiers
2+
3+
#
4+
# Returns a simple true/false boolean indicating whether the version indicates it's a prerelease or not.
5+
#
6+
# TODO: Remove once the common repo is public.
7+
#
8+
9+
inputs:
10+
version:
11+
required: true
12+
13+
outputs:
14+
prerelease:
15+
value: ${{ steps.get_prerelease.outputs.PRERELEASE }}
16+
17+
runs:
18+
using: composite
19+
20+
steps:
21+
- id: get_prerelease
22+
shell: bash
23+
run: |
24+
if [[ "${VERSION}" == *"beta"* || "${VERSION}" == *"alpha"* ]]; then
25+
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
26+
else
27+
echo "PRERELEASE=false" >> $GITHUB_OUTPUT
28+
fi
29+
env:
30+
VERSION: ${{ inputs.version }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Return the release notes extracted from the body of the PR associated with the release.
2+
3+
#
4+
# Returns the release notes from the content of a pull request linked to a release branch. It expects the branch name to be in the format release/vX.Y.Z, release/X.Y.Z, release/vX.Y.Z-beta.N. etc.
5+
#
6+
# TODO: Remove once the common repo is public.
7+
#
8+
inputs:
9+
version:
10+
required: true
11+
repo_name:
12+
required: false
13+
repo_owner:
14+
required: true
15+
token:
16+
required: true
17+
18+
outputs:
19+
release-notes:
20+
value: ${{ steps.get_release_notes.outputs.RELEASE_NOTES }}
21+
22+
runs:
23+
using: composite
24+
25+
steps:
26+
- uses: actions/github-script@v7
27+
id: get_release_notes
28+
with:
29+
result-encoding: string
30+
script: |
31+
const { data: pulls } = await github.rest.pulls.list({
32+
owner: process.env.REPO_OWNER,
33+
repo: process.env.REPO_NAME,
34+
state: 'all',
35+
head: `${process.env.REPO_OWNER}:release/${process.env.VERSION}`,
36+
});
37+
core.setOutput('RELEASE_NOTES', pulls[0].body);
38+
env:
39+
GITHUB_TOKEN: ${{ inputs.token }}
40+
REPO_OWNER: ${{ inputs.repo_owner }}
41+
REPO_NAME: ${{ inputs.repo_name }}
42+
VERSION: ${{ inputs.version }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Return the version extracted from the branch name
2+
3+
#
4+
# Returns the version from the .version file.
5+
#
6+
# TODO: Remove once the common repo is public.
7+
#
8+
9+
outputs:
10+
version:
11+
value: ${{ steps.get_version.outputs.VERSION }}
12+
13+
runs:
14+
using: composite
15+
16+
steps:
17+
- id: get_version
18+
shell: bash
19+
run: |
20+
VERSION=$(head -1 .version)
21+
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+
ossr-username:
5+
required: true
6+
ossr-token:
7+
required: true
8+
signing-key:
9+
required: true
10+
signing-password:
11+
required: true
12+
java-version:
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/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # [email protected]
31+
32+
- name: Publish Android/Java Packages to Maven
33+
shell: bash
34+
run: ./gradlew publish -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: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Create a GitHub release
2+
3+
#
4+
# Creates a GitHub release with the given version.
5+
#
6+
# TODO: Remove once the common repo is public.
7+
#
8+
9+
inputs:
10+
token:
11+
required: true
12+
files:
13+
required: false
14+
name:
15+
required: true
16+
body:
17+
required: true
18+
tag:
19+
required: true
20+
commit:
21+
required: true
22+
draft:
23+
default: false
24+
required: false
25+
prerelease:
26+
default: false
27+
required: false
28+
fail_on_unmatched_files:
29+
default: true
30+
required: false
31+
32+
runs:
33+
using: composite
34+
35+
steps:
36+
- uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
37+
with:
38+
body: ${{ inputs.body }}
39+
name: ${{ inputs.name }}
40+
tag_name: ${{ inputs.tag }}
41+
target_commitish: ${{ inputs.commit }}
42+
draft: ${{ inputs.draft }}
43+
prerelease: ${{ inputs.prerelease }}
44+
fail_on_unmatched_files: ${{ inputs.fail_on_unmatched_files }}
45+
files: ${{ inputs.files }}
46+
env:
47+
GITHUB_TOKEN: ${{ inputs.token }}

.github/actions/rl-scanner/action.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
- name: Configure AWS credentials
24+
uses: aws-actions/configure-aws-credentials@v1
25+
with:
26+
role-to-assume: ${{ env.PRODSEC_TOOLS_ARN }}
27+
aws-region: us-east-1
28+
mask-aws-account-id: true
29+
30+
- name: Install RL Wrapper
31+
shell: bash
32+
run: |
33+
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"
34+
- name: Run RL Scanner
35+
shell: bash
36+
env:
37+
RLSECURE_LICENSE: ${{ env.RLSECURE_LICENSE }}
38+
RLSECURE_SITE_KEY: ${{ env.RLSECURE_SITE_KEY }}
39+
SIGNAL_HANDLER_TOKEN: ${{ env.SIGNAL_HANDLER_TOKEN }}
40+
PYTHONUNBUFFERED: 1
41+
run: |
42+
if [ ! -f "${{ inputs.artifact-path }}" ]; then
43+
echo "Artifact not found: ${{ inputs.artifact-path }}"
44+
exit 1
45+
fi
46+
rl-wrapper \
47+
--artifact "${{ inputs.artifact-path }}" \
48+
--name "${{ github.event.repository.name }}" \
49+
--version "${{ inputs.version }}" \
50+
--repository "${{ github.repository }}" \
51+
--commit "${{ github.sha }}" \
52+
--build-env "github_actions" \
53+
--suppress_output
54+
# Check the outcome of the scanner
55+
if [ $? -ne 0 ]; then
56+
echo "RL Scanner failed."
57+
echo "scan-status=failed" >> $GITHUB_ENV
58+
exit 1
59+
else
60+
echo "RL Scanner passed."
61+
echo "scan-status=success" >> $GITHUB_ENV
62+
fi
63+
outputs:
64+
scan-status:
65+
description: 'The outcome of the scan process.'
66+
value: ${{ env.scan-status }}

.github/actions/tag-exists/action.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Return a boolean indicating if a tag already exists for the repository
2+
3+
#
4+
# Returns a simple true/false boolean indicating whether the tag exists or not.
5+
#
6+
# TODO: Remove once the common repo is public.
7+
#
8+
9+
inputs:
10+
token:
11+
required: true
12+
tag:
13+
required: true
14+
15+
outputs:
16+
exists:
17+
description: 'Whether the tag exists or not'
18+
value: ${{ steps.tag-exists.outputs.EXISTS }}
19+
20+
runs:
21+
using: composite
22+
23+
steps:
24+
- id: tag-exists
25+
shell: bash
26+
run: |
27+
GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/${TAG_NAME}"
28+
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s -H "Authorization: token ${GITHUB_TOKEN}")
29+
if [ "$http_status_code" -ne "404" ] ; then
30+
echo "EXISTS=true" >> $GITHUB_OUTPUT
31+
else
32+
echo "EXISTS=false" >> $GITHUB_OUTPUT
33+
fi
34+
env:
35+
TAG_NAME: ${{ inputs.tag }}
36+
GITHUB_TOKEN: ${{ inputs.token }}

.github/workflows/java-release.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Create Java and GitHub Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
java-version:
7+
required: true
8+
type: string
9+
10+
secrets:
11+
ossr-username:
12+
required: true
13+
ossr-token:
14+
required: true
15+
signing-key:
16+
required: true
17+
signing-password:
18+
required: true
19+
github-token:
20+
required: true
21+
22+
### TODO: Replace instances of './.github/actions/' w/ `auth0/dx-sdk-actions/` and append `@latest` after the common `dx-sdk-actions` repo is made public.
23+
### TODO: Also remove `get-prerelease`, `get-version`, `release-create`, `tag-create` and `tag-exists` actions from this repo's .github/actions folder once the repo is public.
24+
25+
jobs:
26+
release:
27+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/'))
28+
runs-on: ubuntu-latest
29+
environment: release
30+
31+
steps:
32+
# Checkout the code
33+
- uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
# Get the version from the branch name
38+
- id: get_version
39+
uses: ./.github/actions/get-version
40+
41+
# Get the prerelease flag from the branch name
42+
- id: get_prerelease
43+
uses: ./.github/actions/get-prerelease
44+
with:
45+
version: ${{ steps.get_version.outputs.version }}
46+
47+
# Get the release notes
48+
- id: get_release_notes
49+
uses: ./.github/actions/get-release-notes
50+
with:
51+
token: ${{ secrets.github-token }}
52+
version: ${{ steps.get_version.outputs.version }}
53+
repo_owner: ${{ github.repository_owner }}
54+
repo_name: ${{ github.event.repository.name }}
55+
56+
# Check if the tag already exists
57+
- id: tag_exists
58+
uses: ./.github/actions/tag-exists
59+
with:
60+
tag: ${{ steps.get_version.outputs.version }}
61+
token: ${{ secrets.github-token }}
62+
63+
# If the tag already exists, exit with an error
64+
- if: steps.tag_exists.outputs.exists == 'true'
65+
run: exit 1
66+
67+
# Publish the release to Maven
68+
- uses: ./.github/actions/maven-publish
69+
with:
70+
java-version: ${{ inputs.java-version }}
71+
ossr-username: ${{ secrets.ossr-username }}
72+
ossr-token: ${{ secrets.ossr-token }}
73+
signing-key: ${{ secrets.signing-key }}
74+
signing-password: ${{ secrets.signing-password }}
75+
76+
# Create a release for the tag
77+
- uses: ./.github/actions/release-create
78+
with:
79+
token: ${{ secrets.github-token }}
80+
name: ${{ steps.get_version.outputs.version }}
81+
body: ${{ steps.get_release_notes.outputs.release-notes }}
82+
tag: ${{ steps.get_version.outputs.version }}
83+
commit: ${{ github.sha }}
84+
prerelease: ${{ steps.get_prerelease.outputs.prerelease }}

0 commit comments

Comments
 (0)