Skip to content

Journalscript v0.5.4 #77

Journalscript v0.5.4

Journalscript v0.5.4 #77

name: Homebrew Tap publisher
on:
release:
types: [published]
jobs:
formula:
name: Create Homebre formula
runs-on: ubuntu-latest
env:
VERSION: ${{github.event.release.tag_name}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Download release source tarball
run: gh release download ${VERSION} --archive=tar.gz --repo al3jandr0/journalscript
- name: Create formula
run: |
SHA256=$(shasum -a 256 ./*.tar.gz | cut -d ' ' -f 1)
echo "sha256=$SHA256"
FORMULA_URL="https://github.com/${{ github.repository }}/archive/refs/tags/${VERSION}.tar.gz"
bash ci/make_formula.sh "$FORMULA_URL" "$SHA256" "$VERSION"
- name: Upload formula to release
run: gh release upload ${VERSION} journalscript.rb
- name: Upload formula artifact to workflow
uses: actions/upload-artifact@v3
with:
name: homebrew-formula
path: ./journalscript.rb
if-no-files-found: error
retention-days: 5
publish:
name: Publish to Hombrew tap
runs-on: ubuntu-latest
needs: [formula]
if: success()
permissions:
contents: write
pull-requests: write
env:
RELEASE_TITLE: ${{github.event.release.name}}
VERSION: ${{github.event.release.tag_name}}
GITHUB_TOKEN: ${{ secrets.INTER_REPO_TOKEN }}
GH_TOKEN: ${{ secrets.INTER_REPO_TOKEN }}
steps:
- name: Check out tap repository
uses: actions/checkout@v3
with:
repository: al3jandr0/homebrew-tap
token: ${{ secrets.INTER_REPO_TOKEN }}
- name: Download formula asset
uses: actions/download-artifact@v3
with:
name: homebrew-formula
- name: Commit formula
run: |
mkdir -p Formula
cp -f journalscript.rb Formula/journalscript.rb
git config user.name github-actions
git config user.email [email protected]
git add Formula/journalscript.rb
git commit -m "Update formula: ${RELEASE_TITLE}"
git push origin main
# Not creating a PR because of a bug in gh pr create
# Refs:
# - https://github.com/cli/cli/issues/575#issuecomment-1163143215
# - https://github.com/cli/cli/issues/2691
#- name: Create pr
# run: |
# gh pr create -d \
# --title "Update formula: ${RELEASE_TITLE}" \
# --body "Update formula: ${RELEASE_TITLE}" \
# --repo "al3jandr0/hombrew-tap" \
# --base "upstream/main" \
# --head "hombrew-tap:origin/journalscript-${VERSION}" \
# --label 'pr-pull'