Update Outdated Bitrise Steps Versions #5
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: Update Outdated Bitrise Steps Versions | |
on: | |
schedule: | |
- cron: "0 3 * * 0" # Runs every Sunday at 03:00 UTC | |
workflow_dispatch: # Allow manual triggering | |
jobs: | |
update-steps: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
# Step 3: Install dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
# Step 4: Run the script to update Bitrise steps | |
- name: Run update script | |
id: update_script | |
run: | | |
python ./test-fixtures/update_bitrise_steps.py | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Step 5: Determine the PR Version Number | |
- 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 version is: v${next_version}" | |
echo "next_version=${next_version}" >> $GITHUB_ENV | |
echo "current_date=$current_date" >> $GITHUB_ENV | |
# Step 6: Check for changes | |
- name: Commit changes if any | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git diff | |
git diff --quiet || (git add bitrise.yml && git commit -m "Update outdated Bitrise steps") | |
# Step 7: Create a Pull Request | |
- name: Create a Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: update/bitrise-steps | |
commit-message: "Update [v${{ env.next_version }}] outdated Bitrise steps ${{ env.current_date }}" | |
title: "Bump [v${{ env.next_version }}] Update outdated Bitrise steps ${{ env.current_date }}" | |
body: | | |
This PR updates the outdated Bitrise steps to their latest versions. | |
reviewers: mdotb-moz,clarmso,isabelrios | |
# Step 8: Send a message to slack if there is a failure | |
notify-on-failure: | |
runs-on: ubuntu-latest | |
needs: update-steps | |
if: failure() # Trigger only if the 'update-steps' job fails | |
steps: | |
- name: Report to Slack | |
id: slack | |
uses: slackapi/[email protected] | |
with: | |
payload-file-path: "./test-fixtures/ci/slack-notification-payload-update-bitrise-steps.json" | |
payload-templated: true | |
webhook: ${{ secrets.WEBHOOK_SLACK_TOKEN }} | |
webhook-type: incoming-webhook | |
env: | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_RUNID: ${{ github.run_id }} | |
GITHUB_REF_NAME: ${{ github.ref_name }} | |
GITHUB_SHA: ${{ github.sha }} | |