Skip to content

Commit

Permalink
Add Discord integration to release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dankochetov committed Dec 13, 2022
1 parent a2b60a5 commit a4036d1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/release-beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ jobs:
- name: Publish
run: |
beta=$(npm view --json ${{ matrix.package }} dist-tags.beta | jq -r)
current=$(jq -r .version package.json)
if [[ $beta != $current ]]; then
version=$(jq -r .version package.json)
if [[ $beta != $version ]]; then
echo "Beta: $beta"
echo "Current: $current"
echo "Current: $version"
(cd .. && pnpm i)
pnpm run release:beta
# Post release message to Discord
curl -X POST -H "Content-Type: application/json" -d "{\"embeds\": [{\"title\": \"New \`${{ matrix.package }}\` release\! 🎉\", \"url\": \"https://www.npmjs.com/package/${{ matrix.package }}/v/$version\", \"color\": \"12907856\", \"fields\": [{\"name\": \"Version\", \"value\": \"$version\"}, {\"name\": \"Tag\", \"value\": \"beta\"}]}]}" ${{ secrets.DISCORD_DEV_RELEASE_WEBHOOK_URL }}
else
echo "Already up to date: $current"
echo "Already up to date: $version"
fi
working-directory: ${{ matrix.package }}
env:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-feature-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
pnpm run release --tag $tag
# Post release message to Discord
curl -X POST -H "Content-Type: application/json" -d "{\"embeds\": [{\"title\": \"New \`${{ matrix.package }}\` release\! 🎉\", \"url\": \"https://www.npmjs.com/package/${{ matrix.package }}/v/$version\", \"color\": \"12907856\", \"fields\": [{\"name\": \"Version\", \"value\": \"$version\"}, {\"name\": \"Tag\", \"value\": \"$tag\"}]}]}" ${{ secrets.DISCORD_DEV_RELEASE_WEBHOOK_URL }}
working-directory: ${{ matrix.package }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
11 changes: 7 additions & 4 deletions .github/workflows/release-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ jobs:
- name: Publish
run: |
latest=$(npm view --json ${{ matrix.package }} dist-tags.latest | jq -r)
current=$(jq -r .version package.json)
version=$(jq -r .version package.json)
if [[ $latest != $current ]]; then
if [[ $latest != $version ]]; then
echo "Latest: $latest"
echo "Current: $current"
echo "Current: $version"
(cd .. && pnpm i)
pnpm run release
# Post release message to Discord
curl -X POST -H "Content-Type: application/json" -d "{\"embeds\": [{\"title\": \"New \`${{ matrix.package }}\` release\! 🎉\", \"url\": \"https://www.npmjs.com/package/${{ matrix.package }}\", \"color\": \"12907856\", \"fields\": [{\"name\": \"Version\", \"value\": \"$version\"}]}]}" ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
else
echo "Already up to date: $current"
echo "Already up to date: $version"
fi
working-directory: ${{ matrix.package }}
env:
Expand Down

0 comments on commit a4036d1

Please sign in to comment.