Integration fixes #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Promote | ||
on: | ||
workflow_call: | ||
inputs: | ||
build-number: | ||
type: string | ||
description: Build number used to build artifact to be promoted | ||
target-repository: | ||
type: string | ||
description: Repository to promote to | ||
target-branch: | ||
type: string | ||
description: Target branch to promote token | ||
secrets: | ||
CLIENT_BOT_PAT: | ||
required: true | ||
GITHUB_TOKEN: | ||
required: true | ||
jobs: | ||
validate-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup jfrog shell | ||
uses: jfrog/setup-jfrog-cli@v4 | ||
env: | ||
JF_URL: ${{ vars.JFROG_PLATFORM_URL }} | ||
with: | ||
oidc-provider-name: ${{ secrets.JFROG_OIDC_PROVIDER }} | ||
oidc-audience: ${{ secrets.JFROG_OIDC_AUDIENCE }} | ||
- name: Get info | ||
id: get-build-info | ||
run: | | ||
echo build-info=$(jf rt curl /api/build/clients-java-push-to-dev/${{ inputs.build-number }}) >> $GITHUB_OUTPUT | ||
- name: Get commit hash from repo | ||
id: get-commit-hash | ||
run: | | ||
echo commit-hash=$(echo '${{ steps.get-build-info.outputs.build-info }}' | jq -r '.buildInfo.vcs[].revision') >> $GITHUB_OUTPUT | ||
- name: Get build name | ||
id: get-build-name | ||
run: | | ||
echo build-name=$(echo '${{ steps.get-build-info.outputs.build-info }}' | jq -r '.buildInfo.name') >> $GITHUB_OUTPUT | ||
- name: Debug | ||
run: | | ||
echo "commit-hash: '${{ steps.get-commit-hash.outputs.commit-hash }}'" | ||
echo "build-name: '${{ steps.get-build-name.outputs.build-name }}'" | ||
# Needed since we are using actions which are part of the repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
# Fetch the whole history to prevent unrelated history errors | ||
fetch-depth: "0" | ||
ref: ${{ inputs.target-branch }} | ||
token: ${{ secrets.CLIENT_BOT_PAT }} | ||
- name: Fast forward | ||
shell: bash | ||
run: git merge --ff-only ${{ inputs.ref-to-merge }} | ||
- name: Add tagging message | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: "Promote to prod [skip ci]" | ||
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
tagging_message: Promote to PROD | ||
branch: ${{ inputs.target-branch }} | ||
- name: Upload changes to remote head branch | ||
shell: bash | ||
run: git push | ||
- name: Promote build | ||
run: | | ||
jf rt build-promote ${{ steps.get-build-name.outputs.build-name }} ${{ inputs.build-number }} ${{ inputs.target-repository }} | ||
- name: Get artifact version | ||
id: get-artifact-version | ||
working-directory: client | ||
run: | | ||
echo artifact-version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) >> $GITHUB_OUTPUT | ||
- name: Create GitHub release | ||
uses: ./.github/actions/github-release | ||
with: | ||
artifact-version: ${{ steps.get-artifact-version.outputs.artifact-version }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |