diff --git a/.github/scripts/get-release.sh b/.github/scripts/get-release.sh index 5c0dc9b01..1f674b474 100644 --- a/.github/scripts/get-release.sh +++ b/.github/scripts/get-release.sh @@ -2,21 +2,19 @@ if [[ $GITHUB_REF == refs/tags/v* ]] then - if [[ $GITHUB_ACTOR != 'dependabot[bot]' ]] - then - - if [[ $GITHUB_PRE_RELEASE == true ]] - then - echo "PRE_RELEASE" - elif [[ $GITHUB_COMMITISH == 'main' ]] - then - echo "RELEASE" - fi - else - echo "Dependabot has no permission to publish!" - exit 1 - fi + if [[ $GITHUB_ACTOR != 'dependabot[bot]' ]] + then + if [[ $GITHUB_COMMITISH == 'main' && $GITHUB_PRE_RELEASE == false ]] + then + echo "RELEASE" + else + echo "PRE_RELEASE" + fi + else + echo "Dependabot has no permission to publish!" + exit 1 + fi else - echo "Your tag has to start with 'v'" - exit 1 + echo "Your tag has to start with 'v'" + exit 1 fi diff --git a/.github/scripts/publish-npm.sh b/.github/scripts/publish-npm.sh index 46d14b413..7518db10b 100644 --- a/.github/scripts/publish-npm.sh +++ b/.github/scripts/publish-npm.sh @@ -13,17 +13,19 @@ fi echo "🛠 Forge all packages version numbers" echo "which package version ?: $VALID_SEMVER_VERSION" -npm version --no-git-tag-version "$VALID_SEMVER_VERSION" +npm version --no-git-tag-version "$VALID_SEMVER_VERSION" echo "📦 Create packages" -npm pack --quiet +npm pack --quiet TAG="latest" -if [[ $PRE_RELEASE == 'true' ]]; then +if [[ "$GITHUB_COMMITISH" =~ v[0-9]+ ]];then + TAG=$GITHUB_COMMITISH +elif [[ $PRE_RELEASE == 'true' ]]; then TAG="next" fi -echo "📰 Publish Package to Registry with tag: $TAG)" +echo "📰 Publish Package to Registry with tag: $TAG" for REGISTRY in 'GITHUB' 'NPM' do echo "🔒 Authenticate $REGISTRY NPM Registry" diff --git a/.github/workflows/03-publish-packages.yml b/.github/workflows/03-publish-packages.yml index 0cc7d805d..609e60202 100644 --- a/.github/workflows/03-publish-packages.yml +++ b/.github/workflows/03-publish-packages.yml @@ -20,8 +20,6 @@ jobs: publish: name: Publish latest package versions to GitHub Packages runs-on: ubuntu-latest - strategy: - fail-fast: false steps: - name: ⬇ Checkout repo uses: actions/checkout@v3 @@ -43,6 +41,7 @@ jobs: RELEASE: ${{ inputs.release }} PRE_RELEASE: ${{ inputs.preRelease }} VALID_SEMVER_VERSION: ${{ inputs.version }} + GITHUB_COMMITISH: ${{ github.event.release.target_commitish }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}