Create a PR to build the app using newest a-s version available #836
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create a PR to build the app using newest a-s version available | |
on: | |
schedule: | |
- cron: '0 15 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [3.7] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./test-fixtures/requirements.txt | |
- name: 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 "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.version }}"))') | |
echo $branch | |
if [ -z "$branch" ]; then echo "BRANCH_CREATED=false" >> $GITHUB_ENV; else echo "BRANCH_CREATED=true" >> $GITHUB_ENV;fi | |
- name: Update rust-component version | |
if: env.BRANCH_CREATED == 'false' | |
run: |- | |
git diff | |
git diff --quiet || (git add Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Client.xcodeproj/project.pbxproj) | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
if: env.BRANCH_CREATED == 'false' | |
with: | |
commit-message: Auto update SPM with latest rust-component release ${{ env.version }} | |
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
committer: GitHub <[email protected]> | |
title: Auto update SPM with latest rust-component ${{ env.version }} | |
branch: update-spm-new-rust-component-tag-${{ env.version }} | |
labels: Do Not Merge ⛔️ | |
token: ${{ secrets.GITHUB_TOKEN }} |