Release v7.9.0.1 #20
Workflow file for this run
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
# | |
# Copyright (C) 2024 Badabing2005 | |
# SPDX-License-Identifier: AGPL-3.0-or-later | |
# | |
# This program is free software: you can redistribute it and/or modify it under | |
# the terms of the GNU Affero General Public License as published by the Free | |
# Software Foundation, either version 3 of the License, or (at your option) any | |
# later version. | |
# | |
# This program is distributed in the hope that it will be useful, but WITHOUT | |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License | |
# for more details. | |
# | |
# You should have received a copy of the GNU Affero General Public License | |
# along with this program. If not, see <https://www.gnu.org/licenses/>. | |
# | |
# Also add information on how to contact you by electronic and paper mail. | |
# | |
# If your software can interact with users remotely through a computer network, | |
# you should also make sure that it provides a way for users to get its source. | |
# For example, if your program is a web application, its interface could | |
# display a "Source" link that leads users to an archive of the code. There are | |
# many ways you could offer source, and different solutions will be better for | |
# different programs; see section 13 for the specific requirements. | |
# | |
# You should also get your employer (if you work as a programmer) or school, if | |
# any, to sign a "copyright disclaimer" for the program, if necessary. For more | |
# information on this, and how to apply and follow the GNU AGPL, see | |
# <https://www.gnu.org/licenses/>. | |
name: Update Homebrew Cask | |
on: | |
release: | |
types: [published] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Build tag' | |
required: false | |
jobs: | |
update-cask: | |
if: github.actor == 'badabing2005' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.7' | |
- name: Install Homebrew | |
run: | | |
echo "Installing Homebrew..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
- name: Clone homebrew-cask repo | |
run: | | |
git clone https://github.com/badabing2005/homebrew-PixelFlasher.git | |
cd homebrew-PixelFlasher | |
- name: Determine tag name | |
id: determine-tag | |
run: | | |
if [ -n "${{ github.event.inputs.tag }}" ]; then | |
echo "TAG_NAME=${{ github.event.inputs.tag }}" >> $GITHUB_ENV | |
else | |
echo "TAG_NAME=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | |
fi | |
- name: Check if DMG file exists | |
run: | | |
if ! curl -L --fail "https://github.com/badabing2005/PixelFlasher/releases/download/${{ env.TAG_NAME }}/PixelFlasher.dmg" -o PixelFlasher.dmg; then | |
echo "Error: DMG file not found. Exiting." | |
exit 1 | |
fi | |
NEW_SHA256=$(shasum -a 256 PixelFlasher.dmg | awk '{ print $1 }') | |
echo "NEW_SHA256=$NEW_SHA256" >> $GITHUB_ENV | |
ls -lR | |
- name: Strip leading 'v' from tag name | |
run: | | |
TAG_NAME_STRIPPED=$(echo "${{ env.TAG_NAME }}" | sed 's/^v//') | |
echo "TAG_NAME=$TAG_NAME_STRIPPED" >> $GITHUB_ENV | |
- name: Update Cask version | |
run: | | |
cd homebrew-PixelFlasher/Casks | |
sed -i "s/version \".*\"/version \"${{ env.TAG_NAME }}\"/g" pixelflasher.rb | |
sed -i "s/sha256 \".*\"/sha256 \"${{ env.NEW_SHA256 }}\"/g" pixelflasher.rb | |
- name: Commit and Push changes | |
env: | |
PAT: ${{ secrets.TAP_REPO_PAT }} | |
run: | | |
cd homebrew-PixelFlasher | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git remote set-url origin https://x-access-token:${PAT}@github.com/badabing2005/homebrew-PixelFlasher.git | |
git add . | |
if git diff --cached --quiet; then | |
echo "No changes to commit." | |
else | |
git commit -m "Update PixelFlasher to version v${{ env.TAG_NAME }}" | |
git push origin main | |
fi |