Merge pull request #1139 from rgoldberg/1138-config-slices #8
Workflow file for this run
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
| # | |
| # .github/workflows/tag-pushed.yaml | |
| # | |
| --- | |
| name: tag-pushed | |
| on: | |
| push: | |
| tags: ['**'] | |
| permissions: | |
| contents: write | |
| defaults: | |
| run: | |
| # Force all run commands to not use Rosetta 2 | |
| shell: arch -arm64 /bin/zsh -Negku {0} | |
| jobs: | |
| tag-pushed: | |
| if: ${{!github.event.repository.fork}} | |
| runs-on: macos-26 | |
| steps: | |
| - name: π Checkout repo | |
| env: | |
| GIT_CONFIG_COUNT: 1 | |
| GIT_CONFIG_KEY_0: init.defaultBranch | |
| GIT_CONFIG_VALUE_0: ${{github.event.repository.default_branch}} | |
| uses: actions/checkout@v6 | |
| with: | |
| # Include all history & tags for Scripts/version | |
| fetch-depth: 0 | |
| - name: π§ Setup repo | |
| run: Scripts/setup_workflow_repo | |
| - name: π Delete tag lacking valid signature | |
| run: | | |
| git fetch --force origin "${GITHUB_REF}:${GITHUB_REF}" | |
| if [[\ | |
| "$(git cat-file tag "${GITHUB_REF_NAME}")" != *'-----BEGIN SSH SIGNATURE-----'*'-----END SSH SIGNATURE-----'\ | |
| ]]; then | |
| printf $'Error: Deleting tag %s because it does not have a valid signature\n' "${GITHUB_REF_NAME}" >&2 | |
| git push -d origin "${GITHUB_REF_NAME}" | |
| exit 1 | |
| fi | |
| - name: π· Exit if not a version tag | |
| run: | | |
| if [[ ! "${GITHUB_REF_NAME}" =~ '^v[[:digit:]]+(\.[[:digit:]]+)*(-(alpha|beta|rc)\.[[:digit:]]+)?$' ]]; then | |
| printf $'Exiting because %s is not a version tag\n' "${GITHUB_REF_NAME}" | |
| exit 2 | |
| fi | |
| - name: π³ Delete version tag not on default branch | |
| env: | |
| DEFAULT_BRANCH_NAME: ${{github.event.repository.default_branch}} | |
| run: | | |
| git fetch --force origin "${DEFAULT_BRANCH_NAME}:${DEFAULT_BRANCH_NAME}" | |
| if ! git merge-base --is-ancestor "${GITHUB_REF_NAME}" "${DEFAULT_BRANCH_NAME}"; then | |
| printf $'Error: Deleting version tag %s because it is not on the %s branch\n' "${GITHUB_REF_NAME}"\ | |
| "${DEFAULT_BRANCH_NAME}" >&2 | |
| git push -d origin "${GITHUB_REF_NAME}" | |
| exit 3 | |
| fi | |
| - name: π¦ Build Apple & Intel installers | |
| run: | | |
| Scripts/package package --arch arm64 | |
| Scripts/package package --arch x86_64 | |
| - name: π° Bump custom tap formula | |
| env: | |
| TOKEN_APP_ID: ${{secrets.TOKEN_APP_ID}} | |
| TOKEN_APP_INSTALLATION_ID: ${{secrets.TOKEN_APP_INSTALLATION_ID}} | |
| TOKEN_APP_PRIVATE_KEY: ${{secrets.TOKEN_APP_PRIVATE_KEY}} | |
| run: | | |
| export HOMEBREW_GITHUB_API_TOKEN="$(Scripts/generate_token)" | |
| brew tap "${GITHUB_REPOSITORY_OWNER}/tap" | |
| unsetopt errexit | |
| bump_output="$(brew bump-formula-pr\ | |
| --tag "${GITHUB_REF_NAME}"\ | |
| --revision "${GITHUB_SHA}"\ | |
| --no-fork\ | |
| --no-browse\ | |
| --online\ | |
| --strict\ | |
| --verbose\ | |
| "${GITHUB_REPOSITORY_OWNER}/tap/mas"\ | |
| 2>&1)" | |
| exit_status="${?}" | |
| setopt errexit | |
| printf %s "${bump_output}" | |
| printf %s "${${(f)bump_output}[-1]}" > .build/bump.url | |
| exit "${exit_status}" | |
| - name: π Create draft release | |
| env: | |
| GH_TOKEN: ${{github.token}} | |
| run: | | |
| gh release create\ | |
| "${GITHUB_REF_NAME}"\ | |
| ".build/mas-${GITHUB_REF_NAME#v}-arm64.pkg"\ | |
| ".build/mas-${GITHUB_REF_NAME#v}-x86_64.pkg"\ | |
| .build/bump.url\ | |
| -d\ | |
| ${"${GITHUB_REF_NAME//[^-]}":+-p}\ | |
| -t "${GITHUB_REF_NAME}: ${$(git tag -l "${GITHUB_REF_NAME}" --format='%(contents)')%%$'\n'*}"\ | |
| --generate-notes |