Skip to content

chore(release): πŸ“¦ version packages (#1010) #665

chore(release): πŸ“¦ version packages (#1010)

chore(release): πŸ“¦ version packages (#1010) #665

Workflow file for this run

name: Release
on:
push:
branches:
- main
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
release:
name: Release
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./tooling/gh-actions/setup
- name: Check packages for common errors
run: pnpm turbo --filter "./packages/*" build lint test typecheck
# Using custom token `MY_GITHUB_TOKEN` with more access to avoid rate limiting
- name: Create Release
id: changeset
uses: changesets/[email protected]
with:
commit: "chore(release): πŸ“¦ version packages"
title: "chore(release): πŸ“¦ version packages"
publish: npx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# Changeset has some issues with pnpm so we sync it up manually
- name: Sync lockfile if necessary
if: steps.changeset.outputs.hasChangesets == 'true'
run: |
git checkout changeset-release/main
pnpm install --no-frozen-lockfile
git add .
git commit -m "chore(release): πŸ“¦ sync lockfile"
git push origin changeset-release/main
- name: Send a discord notification
if: steps.changeset.outputs.published == 'true'
uses: actions/github-script@v7
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
with:
github-token: ${{ secrets.MY_GITHUB_TOKEN }}
script: |
fetch(process.env.DISCORD_WEBHOOK_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: `New release available. [Read the changelog](https://github.com/pingdotgg/uploadthing/releases)`
}),
})
.then((res) => {
console.log('Sent discord notification', res)
})
.catch((err) => {
console.error('Error sending discord notification', err)
})
- name: Revalidate banner on dashboard
if: steps.changeset.outputs.published == 'true'
uses: actions/github-script@v7
env:
PING_GH_SIGNING_SECRET: ${{ secrets.PING_GH_SIGNING_SECRET }}
with:
github-token: ${{ secrets.MY_GITHUB_TOKEN }}
script: |
fetch("https://uploadthing.com/api/revalidate-npm-tag", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-ping-signature": process.env.PING_GH_SIGNING_SECRET,
},
})
.then(async (res) => {
console.log("Version revalidated", await res.text());
})
.catch((err) => {
console.error("Error revalidating tag", err);
});