Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 40 additions & 19 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
skipIntegrationTests:
description: 'skip integration tests?'
default: 0
working_branch:
description: 'If already a working in progress release branch'
default: None

jobs:
package_sdks:
Expand All @@ -28,7 +31,7 @@ jobs:
uses: actions/checkout@v2.3.1
with:
fetch-depth: 0
ref: ${{ github.event.inputs.baseBranch }}
ref: ${{ github.event.inputs.working_branch }}

- name: Get token for firebase-workflow-trigger
uses: tibdex/github-app-token@v1
Expand All @@ -48,18 +51,26 @@ jobs:
pip install -r scripts/gha/requirements.txt

- name: Name new branch
if: github.event.inputs.package_version_number != 0
if: github.event.inputs.working_branch == 'None'
run: |
date_str=$(date "+%Y%m%d-%H%M%S")
echo "NEW_BRANCH=${{env.branchPrefix}}${{github.event.inputs.package_version_number}}-${date_str}" >> $GITHUB_ENV

- name: Create new branch
if: github.event.inputs.package_version_number != 0
if: github.event.inputs.working_branch == 'None'
run: |
git remote update
git checkout -b "${NEW_BRANCH}"
echo "UPDATE_LOGFILE=update_log.txt" >> $GITHUB_ENV

- name: Checkout working branch
if: github.event.inputs.working_branch != 'None'
run: |
git remote update
git checkout ${{ github.event.inputs.working_branch }}
echo "UPDATE_LOGFILE=update_log.txt" >> $GITHUB_ENV
echo "NEW_BRANCH=${{ github.event.inputs.working_branch }}" >> $GITHUB_ENV

# Fetch all the zip files from previous run
- name: Fetch Desktop Artifacts
uses: dawidd6/action-download-artifact@v2
Expand All @@ -81,15 +92,36 @@ jobs:
workflow: 'android.yml'
run_id: ${{ github.event.inputs.downloadPreviousRun }}
path: built_artifect

- name: move zip files
run: |
cd built_artifect
find . -type f -name "*.zip" -exec mv {} . \;
ls -l
cd ..

# - name: Update Guids Json
# if: github.event.inputs.package_version_number != 0
# run: |
- name: Package unitypackage
run: |
python build_package.py --zip_dir=built_artifect

- name: Push branch if there are changes
- name: Commit Changes if there is any
run: |
if ! git update-index --refresh; then
git config user.email "firebase-workflow-trigger-bot@google.com"
git config user.name "firebase-workflow-trigger-bot"
git config core.commentChar "%" # so we can use # in git commit messages
git commit -a -m "Update Guids ID"

# Show changes in git log
git diff
# Push branch
git push --set-upstream origin "${NEW_BRANCH}"
fi

- name: Create PR if there is None
if: github.event.inputs.working_branch == 'None'
id: push-branch
run: |
cd firebase-unity-sdk
if ! git update-index --refresh; then
date_str=$(date "+%a %b %d %Y")
commit_title="Update Unity SDK dependencies - ${date_str}"
Expand Down Expand Up @@ -123,17 +155,6 @@ jobs:
echo "::set-output name=branch_pushed::0"
fi

- name: move zip files
run: |
cd built_artifect
find . -type f -name "*.zip" -exec mv {} . \;
ls -l
cd ..

- name: Package unitypackage
run: |
python build_package.py --zip_dir=built_artifect

- name: Listing output
run: |
ls -Rl
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
id: name-branch
run: |
date_str=$(date "+%Y%m%d-%H%M%S")
new_branch=version-${{github.event.inputs.package_version_number}}-${date_str}
new_branch=release-${{github.event.inputs.package_version_number}}-${date_str}
echo "NEW_BRANCH=${new_branch}" >> $GITHUB_ENV
echo "::set-output name=new_branch::${new_branch}"

Expand Down
29 changes: 27 additions & 2 deletions build_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,33 @@ def main(argv):
cmd_args.append("--output_unitypackage=False")
else:
cmd_args.append("--enabled_sections=build_dotnet3 build_dotnet4")

return subprocess.call(cmd_args)

# Check if need to gen new guids
p = subprocess.Popen(cmd_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = p.communicate()
if p.returncode != 0:
error_str = str(error)
split_string = error_str.split("assets:")[-1]
split_string = split_string.rstrip("\\n\'")
print(split_string)
split_string = split_string.split(" ")
split_string = split_string[3:] # exclude first 3 lines
gen_guids_script_path = os.path.join(os.getcwd(), "gen_guids.py")
gen_cmd_args = [
sys.executable,
gen_guids_script_path,
"--guids_file=" + guids_file_path,
"--version=" + last_version,
"--generate_new_guids=True",
]
for file in split_string:
file=file.strip("\"")
print(file)
gen_cmd_args.append(file)
subprocess.call(gen_cmd_args)

# Need to package again if has that error
subprocess.call(cmd_args)

if __name__ == '__main__':
app.run(main)