Skip to content
name: Release snapshot version
on:
# This applies to all branches that are part of our repo, that is all *internal* contributions
push:
branches-ignore:
- 'main'
tags-ignore:
- '**'
# This applies to both *internal* and *external* contributions
pull_request_target:
types: [ opened, synchronize ]
jobs:
test-slack:
runs-on: ubuntu-latest
steps:
- name: (test) Notify slack
uses: slackapi/slack-github-action@v1.24.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK # type is required for custom payloads
with:
payload: |
{
"text": "Acceptance tests failed on trueLayer-java (test!)",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
}
]
}
coverage:
name: Test coverage analysis
uses: ./.github/workflows/coverage.yml
with:
checkout_ref: ${{ github.event.pull_request.head.sha }}
secrets:
coveralls_repo_token: ${{ secrets.COVERALLS_REPO_TOKEN }}
build:
name: Build and tests
with:
checkout_ref: ${{ github.event.pull_request.head.sha }}
uses: ./.github/workflows/build.yml
access-check:
runs-on: ubuntu-latest
steps:
- name: Get User Permission
id: checkAccess
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check User Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
echo "${{ github.triggering_actor }} does not have permissions on this repo."
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
echo "Job originally triggered by ${{ github.actor }}"
exit 1
acceptance-tests:
name: Acceptance tests in Sandbox environment
needs: [build, access-check]
with:
checkout_ref: ${{ github.event.pull_request.head.sha }}
uses: ./.github/workflows/acceptance-tests.yml
secrets:
tl_client_id: ${{ secrets.ACCEPTANCE_TEST_CLIENT_ID }}
tl_client_secret: ${{ secrets.ACCEPTANCE_TEST_CLIENT_SECRET }}
tl_signing_key_id: ${{ secrets.ACCEPTANCE_TEST_SIGNING_KEY_ID }}
tl_signing_private_key: ${{ secrets.ACCEPTANCE_TEST_SIGNING_PRIVATE_KEY }}
release-snapshot:
name: Release to Nexus snapshots repository
runs-on: ubuntu-latest
needs: [build, acceptance-tests]
steps:
- uses: actions/checkout@v4
with:
checkout_ref: ${{ github.event.pull_request.head.sha }}
- name: Setup JDK
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Create Snapshot version
run: |
echo "project_version_snapshot=${{needs.build.outputs.project_version}}-${GITHUB_REF##*/}-SNAPSHOT" >> $GITHUB_ENV
echo "Snapshot project version created: ${{env.project_version_snapshot}}"
- name: Snapshot version check
run: |
SNAPSHOT_VERSION_REGEX="^([0-9]+)\.([0-9]+)\.([0-9]+)-${GITHUB_REF##*/}-SNAPSHOT$";
if [[ "${{env.project_version_snapshot}}" =~ $SNAPSHOT_VERSION_REGEX ]]; then
echo "Project version ${{env.project_version_snapshot}} is valid"
else
echo "Project version ${{env.project_version_snapshot}} is not valid"; exit 1;
fi
- name: Publish to Sonatype snapshot repository
run: ./gradlew -Pversion=${{env.project_version_snapshot}} publishToSonatype
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}