Skip to content

Commit

Permalink
👷 ci for release
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Mar 10, 2024
1 parent f90f299 commit 050a900
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,30 @@ jobs:
id: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RETRY: ${{ github.event.inputs.retry }}
VERSION: ${{ github.event.inputs.version }}
MANIFEST: ${{ github.event.inputs.update_manifest }}
BRAT: ${{ github.event.inputs.update_brat }}
run: |
echo "version: ${{ github.event.inputs.version }}"
echo "retry: ${{ github.event.inputs.retry }}"
echo "update_manifest: ${{ github.event.inputs.update_manifest }}"
echo "update_brat: ${{ github.event.inputs.update_brat }}"
echo "version: $VERSION"
echo "retry: $RETRY"
echo "update_manifest: $MANIFEST"
echo "update_brat: $BRAT"
git config user.name ${{ env.GH_BOT_NAME }}
git config user.email ${{ env.GH_BOT_EMAIL }}
pnpm it
if [[ "${{ github.event.inputs.retry }}" = "true" ]]; then
pnpm install
if [[ "$RETRY" = "true" ]]; then
npm run preversion
else
npm version ${{ github.event.inputs.version }} --no-git-tag-version
npm version $VERSION --no-git-tag-version
fi
VERSION=$(grep '^ "version"' package.json | cut -d'"' -f4)
echo $VERSION
VERSION=$(grep '^ "version"' package.json | cut -d'"' -f4)
echo next version is $VERSION
if git rev-parse "refs/tags/$VERSION" > /dev/null 2>&1; then
if [[ "${{ github.event.inputs.retry }}" = "true" ]]; then
if [[ "$RETRY" = "true" ]]; then
gh release delete $VERSION --cleanup-tag --yes
else
echo "🛑 Tag $VERSION already exists"
Expand All @@ -81,10 +85,10 @@ jobs:
fi
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' distVersion.json
if [ "${{ github.event.inputs.update_manifest }}" = "true" ]; then
if [ "$MANIFEST" = "true" ]; then
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest.json
fi
if [ "${{ github.event.inputs.update_brat }}" = "true" ]; then
if [ "$BRAT" = "true" ]; then
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest-beta.json
fi
Expand All @@ -111,9 +115,11 @@ jobs:
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MANIFEST: ${{ github.event.inputs.update_manifest }}
BRAT: ${{ github.event.inputs.update_brat }}
run: |
prerelease=true
if [ ${{ github.event.inputs.update_manifest }} ]; then
if [ "$MANIFEST" ]; then
prerelease=false
fi
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prettier": "prettier -w 'src/**/*.ts'",
"test": "jest",
"coverage": "jest --coverage",
"preversion": "pnpm run test && pnpm run build",
"preversion": "pnpm run test && node esbuild.config.mjs production",
"version": "auto-changelog -p",
"brat-notes": "run() { auto-changelog --stdout --hide-credit --hide-empty-releases --template .github/changelog.hbs -v $1 --starting-version $1 > release-notes.md; }; run"
},
Expand Down

0 comments on commit 050a900

Please sign in to comment.