-
Notifications
You must be signed in to change notification settings - Fork 2.9k
83 lines (73 loc) · 3.37 KB
/
check-rust-component-dependency.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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 <[email protected]>
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 }}