Revision control

Copy as Markdown

name: Create a PR to build the app using newest a-s version available
on:
schedule:
- cron: '0 15 * * *'
workflow_dispatch:
inputs:
branchName:
description: 'Branch used as target for automation'
required: true
default: 'main'
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./test-fixtures/requirements.txt
- name: Firefox-ios - Modifing Swift Package dependencies
run: |
python ./test-fixtures/update-rust-component-version.py
- name: Get new A-S tag to be used in the PR info
run: |
cd test-fixtures/
chmod u+x read-rust-component-tag.sh
echo "rust_version=$(./read-rust-component-tag.sh)" >> $GITHUB_ENV
- name: Remove temp file created to store the tag info
run: |
cd test-fixtures/
[ ! -e newest_tag.txt ] || rm newest_tag.txt
- name: Script to check if branch exists to not commit again
run: |-
branch=$(curl -X GET -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/mozilla-mobile/firefox-ios/branches?per_page=100 | jq -r '.[].name | select(contains("update-spm-new-rust-component-tag-${{ env.rust_version }}"))')
echo $branch
if [ -z "$branch" ]; then echo "BRANCH_CREATED=false" >> $GITHUB_ENV; else echo "BRANCH_CREATED=true" >> $GITHUB_ENV;fi
- name: Determine PR Version Number
id: versioning
run: |
# This step is used to determine the next version number for the PR title
# The output includes debugging for the piped commands that generate
# the version number and the last line is the version number itself
output=$(bash test-fixtures/ci/get-next-pr-version)
echo "$output"
next_version=$(echo "$output" | tail -n 1) # get the last line of the output
echo "Next Firefox iOS version is: v${next_version}"
echo "next_app_version=${next_version}" >> $GITHUB_ENV
- name: Update rust-component version
if: env.BRANCH_CREATED == 'false'
run: |-
git diff
git diff --quiet || (git add firefox-ios/Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved firefox-ios/Client.xcodeproj/project.pbxproj focus-ios/Blockzilla.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved focus-ios/Blockzilla.xcodeproj/project.pbxproj)
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
if: env.BRANCH_CREATED == 'false'
with:
commit-message: Auto update SPM with latest rust-component release ${{ env.rust_version }}
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: GitHub <noreply@github.com>
title: Refactor [v${{ env.next_app_version }}] Auto update SPM with latest rust-component ${{ env.rust_version }}
branch: update-spm-new-rust-component-tag-${{ env.rust_version }}
token: ${{ secrets.GITHUB_TOKEN }}