Skip to content

Commit

Permalink
Populate env vars for build info
Browse files Browse the repository at this point in the history
Closes gh-18
  • Loading branch information
sjohnr committed Feb 2, 2024
1 parent 2d4eafe commit 8749b4e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/deploy-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,31 @@ jobs:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: spring-io/spring-gradle-build-action@v2
- id: project-version
name: Extract Project Version
run: echo "version=$(cat gradle.properties | grep 'version=' | awk -F'=' '{print $2}')" >> $GITHUB_OUTPUT
- id: branch-name
name: Extract Branch Name
env:
BRANCH: ${{ github.ref_name }}
VERSION: ${{ steps.project-version.outputs.version }}
run: |
branch=$BRANCH
if [[ "$branch" = "main" ]] ; then
branch="${VERSION%.*}.x"
fi
echo "branch=$branch" >> $GITHUB_OUTPUT
- name: Deploy Artifacts
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
ARTIFACTORY_BUILD_NAME: ${{ github.event.repository.name }}-${{ steps.branch-name.outputs.branch }}
ARTIFACTORY_BUILD_NUMBER: ${{ github.run_id }}
ARTIFACTORY_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
ARTIFACTORY_USER_AGENT_NAME: GitHub Actions
ARTIFACTORY_USER_AGENT_VERSION: Unknown
ARTIFACTORY_VCS_REVISION: ${{ github.sha }}
run: ./gradlew publishArtifacts finalizeDeployArtifacts -PossrhUsername="$OSSRH_TOKEN_USERNAME" -PossrhPassword="$OSSRH_TOKEN_PASSWORD" -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" --stacktrace
- id: artifacts-deployed
name: Artifacts Deployed
run: echo "result=true" >> $GITHUB_OUTPUT
- id: project-version
name: Extract Project Version
run: echo "version=$(cat gradle.properties | grep 'version=' | awk -F'=' '{print $2}')" >> $GITHUB_OUTPUT

0 comments on commit 8749b4e

Please sign in to comment.