Skip to content

Commit f587407

Browse files
authored
feat: changed publish to deploy v3 branches with other tag (#62)
* feat: changed publish to deploy v3 branches with other tag
1 parent 43d0dbc commit f587407

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

.github/scripts/get-release.sh

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@
22

33
if [[ $GITHUB_REF == refs/tags/v* ]]
44
then
5-
if [[ $GITHUB_ACTOR != 'dependabot[bot]' ]]
6-
then
7-
8-
if [[ $GITHUB_PRE_RELEASE == true ]]
9-
then
10-
echo "PRE_RELEASE"
11-
elif [[ $GITHUB_COMMITISH == 'main' ]]
12-
then
13-
echo "RELEASE"
14-
fi
15-
else
16-
echo "Dependabot has no permission to publish!"
17-
exit 1
18-
fi
5+
if [[ $GITHUB_ACTOR != 'dependabot[bot]' ]]
6+
then
7+
if [[ $GITHUB_COMMITISH == 'main' && $GITHUB_PRE_RELEASE == false ]]
8+
then
9+
echo "RELEASE"
10+
else
11+
echo "PRE_RELEASE"
12+
fi
13+
else
14+
echo "Dependabot has no permission to publish!"
15+
exit 1
16+
fi
1917
else
20-
echo "Your tag has to start with 'v'"
21-
exit 1
18+
echo "Your tag has to start with 'v'"
19+
exit 1
2220
fi

.github/scripts/publish-npm.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ fi
1313
echo "🛠 Forge all packages version numbers"
1414
echo "which package version ?: $VALID_SEMVER_VERSION"
1515

16-
npm version --no-git-tag-version "$VALID_SEMVER_VERSION"
16+
npm version --no-git-tag-version "$VALID_SEMVER_VERSION"
1717

1818
echo "📦 Create packages"
19-
npm pack --quiet
19+
npm pack --quiet
2020

2121
TAG="latest"
22-
if [[ $PRE_RELEASE == 'true' ]]; then
22+
if [[ "$GITHUB_COMMITISH" =~ v[0-9]+ ]];then
23+
TAG=$GITHUB_COMMITISH
24+
elif [[ $PRE_RELEASE == 'true' ]]; then
2325
TAG="next"
2426
fi
2527

26-
echo "📰 Publish Package to Registry with tag: $TAG)"
28+
echo "📰 Publish Package to Registry with tag: $TAG"
2729
for REGISTRY in 'GITHUB' 'NPM'
2830
do
2931
echo "🔒 Authenticate $REGISTRY NPM Registry"

.github/workflows/03-publish-packages.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ jobs:
2020
publish:
2121
name: Publish latest package versions to GitHub Packages
2222
runs-on: ubuntu-latest
23-
strategy:
24-
fail-fast: false
2523
steps:
2624
- name: ⬇ Checkout repo
2725
uses: actions/checkout@v3
@@ -43,6 +41,7 @@ jobs:
4341
RELEASE: ${{ inputs.release }}
4442
PRE_RELEASE: ${{ inputs.preRelease }}
4543
VALID_SEMVER_VERSION: ${{ inputs.version }}
44+
GITHUB_COMMITISH: ${{ github.event.release.target_commitish }}
4645
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4746
GPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4847

0 commit comments

Comments
 (0)