Merge pull request #695 from Trombach/dependabot/npm_and_yarn/develop… #281
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
permissions: | |
contents: write | |
pull-requests: write | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CHANGESETS_PAT }} | |
lfs: false | |
- run: corepack enable | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: "pnpm" | |
- run: pnpm i | |
- name: Get latest staging ID | |
id: get-staging-id | |
run: | | |
response=`curl -X GET "https://api.vercel.com/v6/deployments?app=astro-homepage" \ | |
-H "Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}" \ | |
-H "Content-Type: application/json" \ | |
| jq '.deployments[] | select(.meta.githubCommitSha == "${{ github.sha }}")'` | |
url=$(jq -r '.url' <<< "$response") | |
message=$(jq '.meta.githubCommitMessage' <<< "$response") | |
echo $url | |
echo $message | |
echo "id=$url" >> "$GITHUB_OUTPUT" | |
echo "message=$message" >> "$GITHUB_OUTPUT" | |
- name: Wait for Vercel build | |
uses: UnlyEd/github-action-await-vercel@v2 | |
if: ${{ contains(steps.get-staging-id.outputs.message, 'Version Packages') }} | |
env: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
with: | |
deployment-url: ${{ steps.get-staging-id.outputs.id }} | |
timeout: 120 | |
poll-interval: 5 | |
- name: Create Release PR | |
id: create-release-pr | |
uses: changesets/action@v1 | |
with: | |
version: pnpm bump-version | |
publish: pnpm promote | |
createGithubReleases: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.CHANGESETS_PAT }} | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
DEPLOYMENT_URL: ${{ steps.get-staging-id.outputs.id}} | |
- name: Create Github release | |
if: ${{ contains(steps.get-staging-id.outputs.message, 'Version Packages') }} | |
run: | | |
tag=`jq -r .version package.json` | |
gh release create $tag --title $tag --generate-notes --latest | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |