diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..0925cbcb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,70 @@ +name: Linkiving frontend release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +concurrency: + group: vercel-release-${{ github.ref }} + cancel-in-progress: false + +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + +jobs: + deploy-production: + runs-on: ubuntu-latest + env: + TAG_NAME: ${{ github.ref_name }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.19.0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.x' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Install Vercel CLI + run: npm install --global vercel@latest + + - name: Pull Vercel production environment + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + + - name: Build production artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + + - name: Deploy production to Vercel + id: deploy + shell: bash + run: | + deployment_url="$(vercel deploy --prebuilt --archive=tgz --prod --token=${{ secrets.VERCEL_TOKEN }})" + echo "deployment_url=${deployment_url}" >> "$GITHUB_OUTPUT" + { + echo "Production release deployed." + echo + echo "- Tag: ${TAG_NAME}" + echo "- URL: ${deployment_url}" + } >> "$GITHUB_STEP_SUMMARY" + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true