Skip to content

Update README.md

Update README.md #132

name: Promote Release Candidate on SemVer Tag Push
on:
push:
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 }}
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
JF_BASE_URL: ${{ vars.JF_BASE_URL }}
JF_PROJECT_KEY: ${{ vars.JF_PROJECT_KEY }}
RELEASE_BUNDLE_SIGNING_KEY: ${{ secrets.RELEASE_BUNDLE_SIGNING_KEY }}
JFROG_BUILD_STATUS: PASS
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v3
with:
version: latest
- name: Fetch the latest Release Bundle
id: fetch_release_bundle
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:
RELEASE_BUNDLE_VERSION: ${{ steps.fetch_release_bundle.outputs.LATEST_RELEASE_BUNDLE_VERSION }}
run: |
PROMOTE_RESULT=$(curl --request "POST" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $JF_ACCESS_TOKEN" \
--header "X-JFrog-Signing-Key-Name: $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/$RELEASE_BUNDLE_VERSION")
echo PROMOTE_RESULT=$PROMOTE_RESULT >> $GITHUB_OUTPUT
- name: Validate Promotion
id: validate_promotion
run: |
echo "Promotion to Prod Result: " ${{ steps.promote_release_bundle.outputs.PROMOTE_RESULT }}
- name: Distribute Release Bundle to Edge Nodes
id: distribute_release_bundle
env:
RELEASE_BUNDLE_VERSION: ${{ steps.fetch_release_bundle.outputs.LATEST_RELEASE_BUNDLE_VERSION }}
run: |
DISTRIBUTION_RESULT=$(curl --request "POST" \
--url "$JF_BASE_URL/lifecycle/api/v2/distribution/distribute/phoenix-project-release-bundle/$RELEASE_BUNDLE_VERSION" \
--header "Authorization: Bearer $JF_ACCESS_TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"dry_run": false,
"auto_create_missing_repositories": "true",
"distribution_rules": [
{
"site_name": "tomjfrogedge1"
},
{
"site_name": "tomjfrogedge2"
}
],
"modifications": {
"mappings": [
{
"input": "phoenix-maven-dev-local",
"output": "phoenix-maven-prod-local"
}
]
}
}')
echo DISTRIBUTION_RESULT=$DISTRIBUTION_RESULT >> $GITHUB_OUTPUT
- name: Validate Distribution
id: validate_distribution
run: |
echo "Distribution Result: ${{ steps.distribute_release_bundle.outputs.DISTRIBUTION_RESULT }}"