Skip to content

test autobuilds on current hotfix #15

test autobuilds on current hotfix

test autobuilds on current hotfix #15

Workflow file for this run

##############################################################################################

Check failure on line 1 in .github/workflows/build-rc-auto.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-rc-auto.yml

Invalid workflow file

(Line: 98, Col: 20): Unrecognized named-value: 'env'. Located at position 1 within expression: env.GH_REF_NAME
#
# This Workflow is responsible for triggering release candidate builds (iOS & Android).
# It runs on every commit pushed to a release branch, but only when the release PR
# has the 'auto-rc-builds' label.
#
##############################################################################################
name: Auto RC builds
on:
push:
branches:
- 'release/*'
# testing branch.
# remove before merge
- 'rc-builds-gh-workflow'
#remove before merge.
#test auto-build on specific release branch
env:
GH_REF_NAME: "release/7.61.6"
jobs:
validate-and-check-label:
name: Validate branch and check PR label
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.extract-version.outputs.semver }}
has-label: ${{ steps.check-label.outputs.has-label }}
permissions:
pull-requests: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Extract semver from branch name
id: extract-version
run: |
#remove before merge.
#test auto-build on specific release branch
BRANCH_NAME="${{ env.GH_REF_NAME }}"
#BRANCH_NAME="${{ github.ref_name }}"
echo "Checking branch: $BRANCH_NAME"
# Validate branch matches release/x.y.z format (semantic versioning)
if [[ "$BRANCH_NAME" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
VERSION="${BRANCH_NAME#release/}"
echo "Valid release branch detected: $BRANCH_NAME (version: $VERSION)"
echo "semver=$VERSION" >> "$GITHUB_OUTPUT"
else
echo "Branch '$BRANCH_NAME' does not match release/x.y.z pattern. Skipping."
echo "semver=" >> "$GITHUB_OUTPUT"
exit 1
fi
- name: Find PR and check for auto-rc-builds label
id: check-label
run: |
#remove before merge.
#test auto-build on specific release branch
BRANCH_NAME="${{ env.GH_REF_NAME }}"
#BRANCH_NAME="${{ github.ref_name }}"
echo "Looking for PR with head branch: $BRANCH_NAME"
# Find PRs where the head branch matches our release branch
PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number' || echo "")
if [[ -z "$PR_NUMBER" ]]; then
echo "No PR found for branch $BRANCH_NAME. Skipping."
echo "has-label=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Found PR #$PR_NUMBER"
# Check if PR has the auto-rc-builds label
LABELS=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name' || echo "")
if echo "$LABELS" | grep -qx "auto-rc-builds"; then
echo "PR #$PR_NUMBER has 'auto-rc-builds' label. Proceeding with build."
echo "has-label=true" >> "$GITHUB_OUTPUT"
else
echo "PR #$PR_NUMBER does not have 'auto-rc-builds' label. Skipping build."
echo "has-label=false" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
bump-version:
uses: ./.github/workflows/update-latest-build-version.yml
needs: validate-and-check-label
if: needs.validate-and-check-label.outputs.has-label == 'true'
with:
#remove before merge.
#test auto-build on specific release branch
# base-branch: ${{ github.ref_name }}
base-branch: ${{ env.GH_REF_NAME }}
secrets:
PR_TOKEN: ${{ secrets.PR_TOKEN }}
permissions:
id-token: write
contents: write
trigger-rc-build:
runs-on: ubuntu-latest
needs:
- validate-and-check-label
- bump-version
if: needs.validate-and-check-label.outputs.has-label == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
#ref: ${{ github.ref }}
#remove before merge.
#test auto-build on specific release branch
ref: ${{ env.GH_REF_NAME }}
- name: Trigger RC Build
env:
SEMVER: ${{ needs.validate-and-check-label.outputs.semver }}
# GH_REF_NAME: ${{ github.ref_name }}
#remove before merge.
#test auto-build on specific release branch
GH_REF_NAME: ${{ env.GH_REF_NAME }}
COMMIT_HASH: ${{ needs.bump-version.outputs.commit-hash }}
BUILD_NUMBER: ${{ needs.bump-version.outputs.build-version }}
BITRISE_APP_ID: ${{ secrets.BITRISE_APP_ID }}
BITRISE_BUILD_TRIGGER_TOKEN: ${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}
BITRISE_API_TOKEN: ${{ secrets.BITRISE_API_TOKEN }}
run: ./scripts/rc-builds.sh