Skip to content

Release Publish: 214c16ba-8a42-4313-9d17-72a5e78656b1 #12

Release Publish: 214c16ba-8a42-4313-9d17-72a5e78656b1

Release Publish: 214c16ba-8a42-4313-9d17-72a5e78656b1 #12

# This workflow is part of the Redis OSS release automation process.
# In addition to regular tag builds, it also supports publishing unstable builds.
on:
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag to build'
required: true
release_type:
description: 'Type of release to upload (public, internal)'
required: true
workflow_uuid:
description: 'Optional UUID to identify this workflow run'
required: false
release_handle:
description: 'JSON string containing release handle information'
required: true
risk_level:
description: 'Risk level for the release (edge, candidate, stable)'
required: true
# UUID is used to help automation to identify workflow run in the list of workflow runs.
run-name: "Release Publish${{ github.event.inputs.workflow_uuid && format(': {0}', github.event.inputs.workflow_uuid) || '' }}"
jobs:
upload-packages:
runs-on: ubuntu-latest
permissions:
# to merge changes into release
contents: write
# to download artifacts from build workflow
actions: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate inputs
id: validate-inputs
run: |
if [ "${{ inputs.release_type }}" != "public" ]; then
echo "Invalid release_type: ${{ inputs.release_type }}"
exit 1
fi
env_name="production"
echo "env_name=$env_name" >> $GITHUB_OUTPUT
- name: Ensure Release Branch
if: github.event.inputs.release_tag != 'unstable'
id: ensure-branch
uses: redis-developer/redis-oss-release-automation/.github/actions/ensure-release-branch@main
with:
release_tag: ${{ github.event.inputs.release_tag }}
release_branch: ${{ github.ref_name }}
allow_modify: false
gh_token: ${{ secrets.GITHUB_TOKEN }}
release_version_branch_prefix: automation/
- name: Parse release handle
id: parse-handle
uses: redis-developer/redis-oss-release-automation//.github/actions/parse-release-handle@main
with:
release_handle: ${{ github.event.inputs.release_handle }}
- name: Upload packages
id: upload
uses: ./.github/actions/upload
with:
run_id: ${{ steps.parse-handle.outputs.run_id }}
github_token: ${{ secrets.GITHUB_TOKEN }}
risk_level: ${{ inputs.risk_level }}
snapcraft_store_credentials: ${{ secrets.SNAP_TOKEN }}
- name: Merge back to release branch
if: github.event.inputs.release_tag != 'unstable' && github.event.inputs.release_type == 'public'
id: merge-back
# merge only public releases into main
uses: redis-developer/redis-oss-release-automation/.github/actions/merge-branches-verified@main
with:
from_branch: ${{ steps.ensure-branch.outputs.release_version_branch }}
to_branch: ${{ steps.ensure-branch.outputs.release_branch }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create version tag
uses: redis-developer/redis-oss-release-automation/.github/actions/create-tag-verified@main
if: steps.merge-back.outputs.merge_commit_sha != ''
with:
tag: v${{ inputs.release_tag }}
ref: ${{ steps.merge-back.outputs.merge_commit_sha }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release info
id: create-release-info
shell: bash
run: |
cat <<JQ > jq
{
release_tag: "${{ github.event.inputs.release_tag }}",
release_type: "${{ github.event.inputs.release_type }}",
run_id: ${{ github.run_id }},
packages: .
}
JQ
cat <<RESULT | jq -f jq >result.json
${{ steps.upload.outputs.upload_info }}
RESULT
- name: Send Success Slack notification
id: slack-success
uses: ./.github/actions/slack-notification
with:
slack_func: slack_format_success_message
slack_channel_id: ${{ vars.SLACK_CHANNEL_ID }}
release_tag: ${{ github.event.inputs.release_tag }}
env: ${{ steps.validate-inputs.outputs.env_name }}
snap_upload_info: ${{ steps.upload.outputs.upload_info }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Add Slack notification info to release info
if: always() && steps.create-release-info.outcome == 'success' && steps.slack-success.outputs.slack_ts != ''
shell: bash
run: |
# Add Slack notification details to result.json
jq --arg slack_ts "${{ steps.slack-success.outputs.slack_ts }}" \
--arg slack_channel_id "${{ secrets.SLACK_CHANNEL_ID }}" \
--arg slack_message_url "${{ steps.slack-success.outputs.slack_url }}" \
'. + {
slack_ts: $slack_ts,
slack_channel_id: $slack_channel_id,
slack_message_url: $slack_message_url
}' result.json > result_with_slack.json
mv result_with_slack.json result.json
echo "Updated result.json with Slack notification info:"
cat result.json | jq '.'
- name: Upload publish result artifact
if: always() && steps.create-release-info.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: release_info
path: result.json
retention-days: 90
- name: Send Failure Slack notification
if: failure()
uses: ./.github/actions/slack-notification
with:
slack_func: slack_format_failure_message
slack_channel_id: ${{ vars.SLACK_CHANNEL_ID }}
release_tag: ${{ github.event.inputs.release_tag }}
env: ${{ steps.validate-inputs.outputs.env_name }}
message: ":ubuntu: SNAP package upload failed"
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}