2022-11-30 01:00:18 +02:00
|
|
|
name: Create Casks PR
|
|
|
|
|
|
|
|
env:
|
|
|
|
HOMEBREW_REPO: Homebrew/homebrew-cask-fonts
|
|
|
|
HOMEBREW_FORK: Finii/homebrew-cask-fonts
|
|
|
|
FORK_USER: Finii
|
2023-05-01 11:02:48 +02:00
|
|
|
FORK_TOKEN: tvguho_cng_11NQ2SVID0Ts6QeJKIWakl_ItimvxTkrjHEtv4scbbEr2HG1Z1EGEgzWgN4BfurH5mHDSFZXRUzTGHLDh1
|
2022-11-30 01:00:18 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
create-casks:
|
|
|
|
name: Create casks
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Fetch stuff (no checkout)
|
|
|
|
uses: Bhacaz/checkout-files@v2
|
|
|
|
with:
|
|
|
|
files: bin/scripts/lib/fonts.json bin/scripts/fetch-archives.sh bin/scripts/generate-casks.sh
|
|
|
|
branch: ${{ github.head_ref || github.ref_name }}
|
|
|
|
- name: Fetch release artifacts
|
|
|
|
run: |
|
|
|
|
cd bin/scripts
|
|
|
|
chmod u+x *
|
2022-12-14 10:50:30 +02:00
|
|
|
./fetch-archives.sh latest
|
2022-11-30 01:00:18 +02:00
|
|
|
- name: Determine release tag
|
|
|
|
id: releasetag
|
|
|
|
run: |
|
|
|
|
TAG=$(ls archives/_Release* | head -n 1 | sed 's/.*_Release_//')
|
|
|
|
echo "Release has tag ${TAG}"
|
|
|
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create all casks
|
|
|
|
run: |
|
|
|
|
cd bin/scripts
|
|
|
|
./generate-casks.sh --setversion ${{ steps.releasetag.outputs.tag }}
|
|
|
|
- name: Upload casks as artifacts
|
2023-01-06 11:24:32 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-11-30 01:00:18 +02:00
|
|
|
with:
|
|
|
|
name: casks
|
|
|
|
path: casks
|
|
|
|
outputs:
|
|
|
|
tag: ${{ steps.releasetag.outputs.tag }}
|
|
|
|
|
|
|
|
commit-casks:
|
|
|
|
name: Create commits
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: create-casks
|
|
|
|
steps:
|
|
|
|
- name: Do some preparation
|
|
|
|
id: notsecret
|
|
|
|
run: |
|
|
|
|
PAK=$(echo "${FORK_TOKEN}" | tr 'A-Za-z' 'N-ZA-Mn-za-m')
|
|
|
|
echo "pak=${PAK}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Checkout Homebrew
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: ${{ env.HOMEBREW_FORK }}
|
|
|
|
path: homebrew
|
|
|
|
ref: nerdfonts
|
|
|
|
token: ${{ steps.notsecret.outputs.pak }}
|
|
|
|
- name: Update Homebrew fork
|
|
|
|
run: |
|
|
|
|
cd homebrew
|
|
|
|
git remote add upstream https://github.com/${{ env.HOMEBREW_REPO }}.git
|
|
|
|
git fetch upstream master
|
|
|
|
git reset --hard upstream/master
|
|
|
|
git push --force origin HEAD:nerdfonts
|
|
|
|
- name: Retrieve new casks
|
2023-01-06 11:24:32 +02:00
|
|
|
uses: actions/download-artifact@v3
|
2022-11-30 01:00:18 +02:00
|
|
|
with:
|
|
|
|
name: casks
|
|
|
|
path: casks
|
|
|
|
- name: Prepare changes
|
|
|
|
run: |
|
|
|
|
cp casks/* homebrew/Casks
|
|
|
|
- name: Commit changes
|
|
|
|
uses: EndBug/add-and-commit@v9
|
|
|
|
with:
|
|
|
|
cwd: homebrew
|
|
|
|
fetch: false
|
|
|
|
add: Casks
|
|
|
|
message: "[ci] Update Nerd Font casks to ${{ needs.create-casks.outputs.tag }}"
|
|
|
|
committer_name: GitHub Actions
|
|
|
|
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
|
|
|
|
- name: Create PR
|
|
|
|
run: |
|
|
|
|
echo "Well, this would automatically create a PR, but this is disabled for now:"
|
|
|
|
echo gh pr create -p ${{ env.HOMEBREW_REPO }} -B master -H nerdfonts -R ${{ env.HOMEBREW_FORK }} -d -f
|