Skip to content

Update Swift Toolchain #622

Update Swift Toolchain

Update Swift Toolchain #622

name: Update Swift Toolchain
on:
schedule:
- cron: "0 21 * * *"
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout to the branch
uses: actions/checkout@v4
- name: Install yq
run: |
sudo add-apt-repository ppa:rmescandon/yq
sudo apt update
sudo apt install yq -y
- name: Update Swift Toolchain
run: |
set -ex
dir=$(curl -s 'https://download.swift.org/swift-5.9-branch/xcode/latest-build.yml' | yq e '.dir' -)
version=$dir
file_name=$version-osx.pkg
branch=swift-5.9-branch
URL=https://download.swift.org/$branch/xcode/$version/$file_name
if curl --output /dev/null --silent --head --fail "$URL"; then
echo $dir > .swift-version
fi
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GH_PAT }}
base: "main"
commit-message: "Update Swift Toolchain"
title: "Update Swift Toolchain"
add-paths: .swift-version
- name: Enable Pull Request Automerge
if: ${{ steps.cpr.outputs.pull-request-url }}
run: gh pr merge --merge --auto ${{ steps.cpr.outputs.pull-request-url }}
env:
GH_TOKEN: ${{ secrets.GH_PAT }}