Publish New Formula #95
This file contains hidden or 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: Publish New Formula | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| shell: bash | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Sunday 20:00 UTC = Monday 04:00 Asia/Shanghai | |
| - cron: "0 20 * * 0" | |
| jobs: | |
| publish-new-formula: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Configure git | |
| run: | | |
| git config --global user.email "${{ secrets.GIT_MAIL }}" | |
| git config --global user.name "${{ secrets.GIT_NAME }}" | |
| - name: Clone Homebrew tap | |
| run: git clone https://github.com/nxtrace/homebrew-nexttrace.git | |
| - name: Generate formulae from NTrace-core latest release | |
| run: | | |
| set -Eeuo pipefail | |
| cd homebrew-nexttrace | |
| RELEASE_REPO=nxtrace/NTrace-core bash genFormula.sh | |
| - name: Commit and push if changed | |
| run: | | |
| set -Eeuo pipefail | |
| cd homebrew-nexttrace | |
| git add Formula README.md genFormula.sh | |
| if git diff --cached --quiet; then | |
| echo "No Homebrew formula update needed." | |
| exit 0 | |
| fi | |
| git commit -m 'Publish a new version with Formula' | |
| git remote set-url origin https://${{ secrets.GT_TOKEN }}@github.com/nxtrace/homebrew-nexttrace.git | |
| git push | |
| - run: echo "This job's status is ${{ job.status }}." |