Skip to content

Commit

Permalink
Fix tagging releases on merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ausias-armesto committed Aug 8, 2024
1 parent 1d55de1 commit da27030
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ jobs:
PR_VERSION=$(node -p "require('./package.json').version")-pr.${{ github.event.pull_request.number }}
jq --arg version "${PR_VERSION}-${BUILD_DATE}" '.version = $version' package.json > temp.json
mv temp.json package.json
yarn publish --tag next
yarn publish --no-git-tag-version --tag next
env:
NODE_AUTH_TOKEN: ${{ steps.setup.outputs.access_token }}
4 changes: 2 additions & 2 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
PR_VERSION=$(node -p "require('./package.json').version")-pr.${{ github.event.pull_request.number }}
jq --arg version "${PR_VERSION}-${BUILD_DATE}" '.version = $version' package.json > temp.json
mv temp.json package.json
yarn publish --tag next
yarn publish --no-git-tag-version --tag next
jq --arg version "${PR_VERSION}" '.version = $version' package.json > temp.json
mv temp.json package.json
yarn publish --tag alpha
yarn publish --no-git-tag-version --tag alpha
env:
NODE_AUTH_TOKEN: ${{ steps.setup.outputs.access_token }}
17 changes: 3 additions & 14 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
echo "" >> changelog.md
echo "### Npm package" >> changelog.md
echo "" >> changelog.md
echo "[Download package](https://www.npmjs.com/package/${{ vars.NPM_PACKAGE_NAME }}/v/${PACKAGE_VERSION})" >> changelog.md
echo "[Download package](https://www.npmjs.com/package/${{ vars.NPM_PACKAGE_NAME }}/v/${PACKAGE_VERSION})" >> changelog.md"
cat changelog.md
echo "release_version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT
- name: Create Release
Expand All @@ -79,25 +80,13 @@ jobs:
gcloud artifacts versions delete --delete-tags --quiet --repository=npm --location=europe-west3 --project=hoprassociation --package ${{ vars.NPM_PACKAGE_NAME }} $version
done < pr_versions.txt
- name: Tag version
run: |
git fetch --all --tags
if git tag -l ${{ steps.changelog.outputs.current_version }} | grep ${{ steps.changelog.outputs.current_version }};
then
echo "Git tag ${{ steps.changelog.outputs.current_version }} alreay exists"
exit 1
else
git tag v${{ steps.changelog.outputs.current_version }}
git push origin v${{ steps.changelog.outputs.current_version }}
fi
- name: Publish to Google Artifact Registry
run: yarn publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ steps.setup.outputs.access_token }}

- name: Publish to npm
run: yarn publish --registry https://registry.npmjs.org --tag latest
run: yarn publish --no-git-tag-version --registry https://registry.npmjs.org --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down

0 comments on commit da27030

Please sign in to comment.