mirror of
https://github.com/bitwarden/ios.git
synced 2025-12-10 17:46:07 -06:00
[PM-24564] Address GitHub Release creation workflow feedback (#1834)
This commit is contained in:
parent
6297605e2a
commit
cfc401f6e0
20
.github/actions/log-inputs/action.yml
vendored
Normal file
20
.github/actions/log-inputs/action.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: 'Log Inputs to Job Summary'
|
||||
description: 'Log workflow inputs to the GitHub Actions job summary'
|
||||
|
||||
inputs:
|
||||
inputs:
|
||||
description: 'Workflow inputs as JSON'
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Log inputs to job summary
|
||||
shell: bash
|
||||
run: |
|
||||
echo "<details><summary>Job Inputs</summary>" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```json' >> $GITHUB_STEP_SUMMARY
|
||||
echo '${{ inputs.inputs }}' >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
echo "</details>" >> $GITHUB_STEP_SUMMARY
|
||||
32
.github/workflows/github-release.yml
vendored
32
.github/workflows/github-release.yml
vendored
@ -13,7 +13,7 @@ on:
|
||||
type: string
|
||||
|
||||
env:
|
||||
ARTIFACTS_PATH: artifacts
|
||||
_ARTIFACTS_PATH: artifacts
|
||||
jobs:
|
||||
create-release:
|
||||
name: Create GitHub Release
|
||||
@ -24,6 +24,11 @@ jobs:
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Log inputs to job summary
|
||||
uses: ./.github/actions/log-inputs
|
||||
with:
|
||||
inputs: ${{ toJson(inputs) }}
|
||||
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
@ -45,6 +50,8 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🔖 Release branch: $release_branch"
|
||||
echo "🔖 Workflow name: $workflow_name"
|
||||
echo "release_branch=$release_branch" >> $GITHUB_OUTPUT
|
||||
echo "workflow_name=$workflow_name" >> $GITHUB_OUTPUT
|
||||
|
||||
@ -62,26 +69,29 @@ jobs:
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo "🔖 App name: $app_name"
|
||||
echo "🔖 App name suffix: $app_name_suffix"
|
||||
|
||||
- name: Download artifacts
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ARTIFACT_RUN_ID: ${{ inputs.artifact-run-id }}
|
||||
run: ./Scripts/download-artifacts.sh $ARTIFACTS_PATH $ARTIFACT_RUN_ID
|
||||
_ARTIFACT_RUN_ID: ${{ inputs.artifact-run-id }}
|
||||
_DOWNLOAD_FILTER: "release_${{ steps.get_release_branch.outputs.app_name_suffix}}"
|
||||
run: ./Scripts/download-artifacts.sh $_ARTIFACTS_PATH $_ARTIFACT_RUN_ID $_DOWNLOAD_FILTER
|
||||
|
||||
- name: Parse version info from run logs and set release tag name
|
||||
id: get_release_info
|
||||
env:
|
||||
_APP_NAME_SUFFIX: ${{ steps.get_release_branch.outputs.app_name_suffix }}
|
||||
run: |
|
||||
if [ -f "$ARTIFACTS_PATH/version-info.zip" ]; then
|
||||
if [ -f "$_ARTIFACTS_PATH/version-info.zip" ]; then
|
||||
echo "🔖 version-info.zip was found, extracting info"
|
||||
unzip -o "$ARTIFACTS_PATH/version-info.zip" -d "tmp"
|
||||
unzip -o "$_ARTIFACTS_PATH/version-info.zip" -d "tmp"
|
||||
filepath="tmp/version-info/version_info.json"
|
||||
version_name=$(jq -r '.version_name' "$filepath")
|
||||
version_number=$(jq -r '.version_number' "$filepath")
|
||||
rm -rf tmp
|
||||
rm "$ARTIFACTS_PATH/version-info.zip"
|
||||
rm "$_ARTIFACTS_PATH/version-info.zip"
|
||||
else
|
||||
echo "::warning::version-info.zip not found. Confirm why the build workflow skipped uploading it. Using default values - 0.0.0 (0)"
|
||||
version_name="0.0.0"
|
||||
@ -151,14 +161,20 @@ jobs:
|
||||
_TAG_NAME: ${{ steps.get_release_info.outputs.tag_name }}
|
||||
_LAST_RELEASE_TAG: ${{ steps.get_release_info.outputs.last_release_tag }}
|
||||
run: |
|
||||
is_latest_release=false
|
||||
if [[ "$_APP_NAME" == "Password Manager" ]]; then
|
||||
is_latest_release=true
|
||||
fi
|
||||
|
||||
echo "⌛️ Creating release for $_APP_NAME $_VERSION_NAME ($_VERSION_NUMBER) on $_RELEASE_BRANCH"
|
||||
release_url=$(gh release create "$_TAG_NAME" \
|
||||
--title "$_APP_NAME $_VERSION_NAME ($_VERSION_NUMBER)" \
|
||||
--target $_RELEASE_BRANCH \
|
||||
--generate-notes \
|
||||
--notes-start-tag "$_LAST_RELEASE_TAG" \
|
||||
--latest=$is_latest_release \
|
||||
--draft \
|
||||
$ARTIFACTS_PATH/*)
|
||||
$_ARTIFACTS_PATH/*)
|
||||
|
||||
# Extract release tag from URL
|
||||
release_id_from_url=$(echo "$release_url" | sed 's/.*\/tag\///')
|
||||
@ -187,7 +203,7 @@ jobs:
|
||||
${product_release_notes}
|
||||
|
||||
${current_body}
|
||||
**Builds Source:** https://github.com/${{ github.repository }}/actions/runs/$ARTIFACT_RUN_ID"
|
||||
**Builds Source:** https://github.com/${{ github.repository }}/actions/runs/$_ARTIFACT_RUN_ID"
|
||||
|
||||
new_release_url=$(gh release edit "$_RELEASE_ID" --notes "$updated_body")
|
||||
|
||||
|
||||
@ -4,33 +4,75 @@
|
||||
# This script downloads build artifacts from a GitHub Actions run and processes them
|
||||
# for the GitHub Release upload. It requires:
|
||||
# - GitHub CLI (gh) to be installed and authenticated
|
||||
# - Two arguments:
|
||||
# - Arguments:
|
||||
# 1. Target path where artifacts should be downloaded
|
||||
# 2. GitHub Actions run ID to download artifacts from
|
||||
# 3. (Optional) Filter type: "download_all", "release_bwpm", or "release_bwa"
|
||||
#
|
||||
# Example usage:
|
||||
# ./download-artifacts.sh 2024.10.2 1234567890
|
||||
# ./download-artifacts.sh 2024.10.2 1234567890 download_all
|
||||
# ./download-artifacts.sh 2024.10.2 1234567890 release_bwpm
|
||||
#
|
||||
# The script will:
|
||||
# 1. Create the target directory if it doesn't exist
|
||||
# 2. Download all artifacts from the specified GitHub Actions run
|
||||
# 2. Download all artifacts from the specified GitHub Actions run (or filtered subset)
|
||||
# 3. Process the artifacts by zipping them with the same name as the folder
|
||||
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: $0 <path> <github_run_id>"
|
||||
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
|
||||
echo "Usage: $0 <path> <github_run_id> [filter_type]"
|
||||
echo " filter_type: 'download_all' (default), 'release_bwpm', or 'release_bwa'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGET_PATH="$1"
|
||||
GITHUB_RUN_ID="$2"
|
||||
FILTER_TYPE="${3:-download_all}"
|
||||
|
||||
mkdir -p "$TARGET_PATH"
|
||||
|
||||
cd "$TARGET_PATH" || exit 1
|
||||
|
||||
echo "🏃♂️💨 Downloading artifacts from GitHub run $GITHUB_RUN_ID..."
|
||||
gh run download "$GITHUB_RUN_ID"
|
||||
|
||||
if [[ "$FILTER_TYPE" == "download_all" ]]; then
|
||||
gh run download "$GITHUB_RUN_ID"
|
||||
else
|
||||
echo "🔍 Filtering artifacts for $FILTER_TYPE..."
|
||||
|
||||
all_artifacts=$(gh api repos/bitwarden/ios/actions/runs/"$GITHUB_RUN_ID"/artifacts --jq '.artifacts[].name')
|
||||
echo "🔍 Artifacts from run $GITHUB_RUN_ID:"
|
||||
echo "$all_artifacts"
|
||||
echo
|
||||
|
||||
if [[ "$FILTER_TYPE" == "release_bwpm" ]]; then
|
||||
filter_pattern="com.8bit.bitwarden-.*.ipa"
|
||||
elif [[ "$FILTER_TYPE" == "release_bwa" ]]; then
|
||||
filter_pattern="com.bitwarden.authenticator-.*.ipa"
|
||||
else
|
||||
echo "❌ Unknown filter type: $FILTER_TYPE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
filtered_artifacts=$(echo "$all_artifacts" | grep -E "$filter_pattern")
|
||||
|
||||
if [ -z "$filtered_artifacts" ]; then
|
||||
echo "👀 No matching artifacts found for $FILTER_TYPE, processing skipped."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "📋 Artifacts to download:"
|
||||
echo "$filtered_artifacts"
|
||||
|
||||
download_cmd="gh run download $GITHUB_RUN_ID -n version-info"
|
||||
while IFS= read -r artifact; do
|
||||
download_cmd="$download_cmd -n \"$artifact\""
|
||||
done <<< "$filtered_artifacts"
|
||||
|
||||
echo "Executing: $download_cmd"
|
||||
eval "$download_cmd"
|
||||
echo "Finished downloading artifacts."
|
||||
fi
|
||||
|
||||
# Output downloaded files
|
||||
file_count=$(find . -type f | wc -l)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user