mirror of
https://github.com/mas-cli/mas
synced 2025-03-06 23:57:21 +00:00
Prepend branch name in version name in certain conditions.
Resolve #705 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
a5a928a2e6
commit
75251ea2e2
7 changed files with 51 additions and 2 deletions
.github/workflows
script
3
.github/workflows/build-test.yml
vendored
3
.github/workflows/build-test.yml
vendored
|
@ -31,6 +31,9 @@ jobs:
|
|||
# Include all history & tags for script/version
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup repo
|
||||
run: script/setup_workflow_repo
|
||||
|
||||
- name: Bootstrap
|
||||
run: script/bootstrap
|
||||
|
||||
|
|
10
.github/workflows/codeql.yml
vendored
10
.github/workflows/codeql.yml
vendored
|
@ -28,7 +28,17 @@ jobs:
|
|||
build-mode: manual
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
env:
|
||||
GIT_CONFIG_COUNT: 1
|
||||
GIT_CONFIG_KEY_0: init.defaultBranch
|
||||
GIT_CONFIG_VALUE_0: ${{github.event.repository.default_branch}}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Include all history & tags for script/version
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup repo
|
||||
run: script/setup_workflow_repo
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
|
|
6
.github/workflows/release-published.yml
vendored
6
.github/workflows/release-published.yml
vendored
|
@ -25,6 +25,12 @@ jobs:
|
|||
GIT_CONFIG_KEY_0: init.defaultBranch
|
||||
GIT_CONFIG_VALUE_0: ${{github.event.repository.default_branch}}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Include all history & tags for script/version
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 🔧 Setup repo
|
||||
run: script/setup_workflow_repo
|
||||
|
||||
- name: 🚰 Apply pr-pull label to custom tap formula bump PR
|
||||
env:
|
||||
|
|
6
.github/workflows/tag-pushed.yml
vendored
6
.github/workflows/tag-pushed.yml
vendored
|
@ -23,6 +23,12 @@ jobs:
|
|||
GIT_CONFIG_KEY_0: init.defaultBranch
|
||||
GIT_CONFIG_VALUE_0: ${{github.event.repository.default_branch}}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Include all history & tags for script/version
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 🔧 Setup repo
|
||||
run: script/setup_workflow_repo
|
||||
|
||||
- name: 🖋 Delete tag lacking valid signature
|
||||
run: |
|
||||
|
|
|
@ -38,7 +38,7 @@ for source in Package.swift Sources Tests; do
|
|||
done
|
||||
|
||||
printf -- $'--> 🐚 ShellCheck\n'
|
||||
shellcheck -s bash -o all -e SC1088,SC1102,SC2296,SC2299,SC2300,SC2301,SC2312 -a -P SCRIPTDIR script/**/*(.)
|
||||
shellcheck -s bash -o all -e SC1088,SC1102,SC2066,SC2296,SC2299,SC2300,SC2301,SC2312 -a -P SCRIPTDIR script/**/*(.)
|
||||
((exit_code |= ${?}))
|
||||
|
||||
printf -- $'--> 〽️ Markdown\n'
|
||||
|
|
13
script/setup_workflow_repo
Executable file
13
script/setup_workflow_repo
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/zsh -Ndefgku
|
||||
#
|
||||
# script/setup_workflow_repo
|
||||
# mas
|
||||
#
|
||||
# Sets up the repo for use in a GitHub workflow.
|
||||
#
|
||||
|
||||
. "${0:a:h}/_setup_script"
|
||||
|
||||
for branch in "${(f)"$(git for-each-ref refs/remotes/origin --format='%(if)%(symref)%(then)%(else)%(refname:strip=-1)%(end)')":#}"; do
|
||||
git branch --track "${branch}" "origin/${branch}" >/dev/null 2>&1 || true
|
||||
done
|
|
@ -8,6 +8,17 @@
|
|||
|
||||
. "${0:a:h}/_setup_script"
|
||||
|
||||
printf $'%s%s\n'\
|
||||
branch="${"$(git rev-parse --abbrev-ref HEAD)":/main}"
|
||||
|
||||
if [[ "${branch}" = HEAD ]]; then
|
||||
if git merge-base --is-ancestor HEAD main; then
|
||||
branch=
|
||||
else
|
||||
branch="${"${(@)"${(fnO)"$(git branch --format '%(ahead-behind:HEAD) %(refname:short)')"}"[1]}"##* }"
|
||||
fi
|
||||
fi
|
||||
|
||||
printf $'%s%s%s\n'\
|
||||
"${branch:+"${branch}-"}"\
|
||||
"${"$(git describe --tags 2>/dev/null)"#v}"\
|
||||
"${"$(git diff-index HEAD --;git ls-files --exclude-standard --others)":+"${MAS_DIRTY_INDICATOR-+}"}"
|
||||
|
|
Loading…
Add table
Reference in a new issue