Skip to content
name: Promote Release Candidate on SemVer Tag Push
on:
push:
branches:
- main
tags:
- 'v*' # Regex pattern to match semantic version strings that begin with a lowercase v followed by any number of digits and dots: v1.0.0, v1.0.0-alpha, etc
jobs:
promote-release-candidate-to-prod:
runs-on: ubuntu-latest
env:
JF_ENV_1: ${{ secrets.JF_ENV_1 }}
JFROG_BUILD_STATUS: PASS
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v3
with:
version: latest
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Tooling Check
run: |
echo 'curl version:' $(curl --version)
echo 'jf version:' $(jf --version)
- name: Fetch the latest Release Bundle
id: fetch_release_bundle
env:
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
JF_BASE_URL: ${{ vars.JF_BASE_URL }}
run: |
{
echo 'LATEST_RELEASE_BUNDLE_VERSION<<EOF'
curl --request GET \
--url "$JF_BASE_URL/lifecycle/api/v2/release_bundle/records/phoenix-project-release-bundle?order_by=created&limit=1" \
--header "Authorization: Bearer $JF_ACCESS_TOKEN" | jq -r '.release_bundles[0].release_bundle_version'
echo EOF
} >> $GITHUB_OUTPUT
- name: Validate Release Bundle Response
id: validate_release_bundle_response
run: |
echo ${{ steps.fetch_release_bundle.outputs.LATEST_RELEASE_BUNDLE_VERSION }}
- name: Promote Release Bundle
id: promote_release_bundle
env:
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
JF_BASE_URL: ${{ vars.JF_BASE_URL }}
RELEASE_BUNDLE_VERSION: ${{ steps.fetch_release_bundle.outputs.LATEST_RELEASE_BUNDLE_VERSION }}
RELEASE_BUNDLE_SIGNING_KEY: ${{ secrets.RELEASE_BUNDLE_SIGNING_KEY }}
run: |
PROMOTE_RESULT=$(curl --request "POST" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $JF_ACCESS_TOKEN" \
--header "X-JFrog-Signing-Key-Name: ${{ secrets.RELEASE_BUNDLE_SIGNING_KEY }}" \
--data '{"environment":"PROD","included_repository_keys":["phoenix-maven-prod-local"],"overwrite_existing_artifacts":false}' \
--url https://tomjfrog.jfrog.io/lifecycle/api/v2/promotion/records/phoenix-project-release-bundle/0.0.1-rc-92) >> $GITHUB_OUTPUT
- name: Validate Promotion
id: validate_promotion
run: |
echo "${{ steps.promote_release_bundle.outputs.PROMOTE_RESULT }}"