Frontend Release PR #30
This file contains hidden or 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: Frontend Release PR | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| type: | |
| type: choice | |
| description: Choose release type | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| default: patch | |
| beta: | |
| type: boolean | |
| description: Prerelease | |
| default: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| releaseIt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.APP_INSTALLATION_TOKEN }} | |
| - name: git config | |
| run: | | |
| git config user.name "${GITHUB_ACTOR}" | |
| git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
| - name: Setup node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: | | |
| npm ci || { | |
| echo "npm ci failed, trying clean install with rollup fix..." | |
| rm -rf node_modules services/frontend/node_modules | |
| npm install --no-optional | |
| } | |
| - name: Frontend Type Check | |
| working-directory: services/frontend | |
| run: npm run type-check | |
| - name: Frontend Build Test | |
| working-directory: services/frontend | |
| run: npm run build | |
| - name: Frontend Lint | |
| working-directory: services/frontend | |
| run: npm run lint | |
| - name: Prepare release | |
| working-directory: services/frontend | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.APP_INSTALLATION_TOKEN }} | |
| BETA_ARG: ${{ github.event.inputs.beta == 'true' && '--preRelease=beta' || '' }} | |
| TYPE_ARG: ${{ github.event.inputs.type != 'patch' && format('--increment={0}', github.event.inputs.type) || '' }} | |
| run: | | |
| # Let release-it handle version detection and incrementing properly | |
| npm run release -- $TYPE_ARG --ci --verbose --no-git.push --no-git.commit --no-git.tag --no-github $BETA_ARG | |
| - name: get-npm-version | |
| id: package-version | |
| uses: martinbeentjes/npm-get-version-action@main | |
| with: | |
| path: services/frontend | |
| - name: Extract release notes | |
| id: extract-release-notes | |
| working-directory: services/frontend | |
| run: | | |
| VERSION=$(cat package.json | grep '"version"' | cut -d'"' -f4) | |
| echo "Extracting release notes for version $VERSION" | |
| # Find the latest frontend tag | |
| LATEST_TAG=$(git describe --tags --match=frontend-v* --abbrev=0 2>/dev/null || echo "") | |
| if [ -z "$LATEST_TAG" ]; then | |
| echo "No previous frontend tag found, using all commits" | |
| FRONTEND_COMMITS=$(git log --oneline --grep="(frontend)" --grep="(all)") | |
| else | |
| echo "Using commits since $LATEST_TAG" | |
| # Get frontend and all scoped commits since last release | |
| FRONTEND_COMMITS=$(git log ${LATEST_TAG}..HEAD --oneline --grep="(frontend)") | |
| ALL_COMMITS=$(git log ${LATEST_TAG}..HEAD --oneline --grep="(all)") | |
| # Combine and format the commits | |
| COMBINED_COMMITS=$(echo -e "$FRONTEND_COMMITS\n$ALL_COMMITS" | sort -u | grep -v "^$" || true) | |
| fi | |
| # Format commits for release notes | |
| if [ -n "$COMBINED_COMMITS" ]; then | |
| RELEASE_NOTES="" | |
| while IFS= read -r commit; do | |
| if [ -n "$commit" ]; then | |
| # Extract commit hash and message | |
| HASH=$(echo "$commit" | cut -d' ' -f1) | |
| MESSAGE=$(echo "$commit" | cut -d' ' -f2-) | |
| RELEASE_NOTES="${RELEASE_NOTES}- ${MESSAGE} ([${HASH}](https://github.com/deploystackio/deploystack/commit/${HASH}))\n" | |
| fi | |
| done <<< "$COMBINED_COMMITS" | |
| else | |
| RELEASE_NOTES="No significant changes since last release." | |
| fi | |
| echo "release_notes<<EOF" >> $GITHUB_OUTPUT | |
| echo -e "$RELEASE_NOTES" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| echo "Release notes extracted:" | |
| echo -e "$RELEASE_NOTES" | |
| - name: Create pull request | |
| uses: peter-evans/create-pull-request@v7 | |
| id: cpr | |
| with: | |
| token: ${{ secrets.APP_INSTALLATION_TOKEN }} | |
| branch: frontend-release | |
| delete-branch: true | |
| commit-message: 'chore(frontend): release v${{ steps.package-version.outputs.current-version}}' | |
| title: '[Frontend Release] v${{ steps.package-version.outputs.current-version}}' | |
| body: | | |
| ## Frontend Release v${{ steps.package-version.outputs.current-version}} | |
| This PR prepares a new frontend release. | |
| When merged, this will: | |
| 1. Create a release tag | |
| 2. Build and publish a multi-architecture Docker image to Docker Hub | |
| The Docker image will be available at: | |
| - `deploystack/frontend:latest` | |
| - `deploystack/frontend:v${{ steps.package-version.outputs.current-version}}` | |
| ### Supported Architectures | |
| - `linux/amd64` (Intel/AMD) | |
| - `linux/arm64` (Apple Silicon, AWS Graviton) | |
| - `linux/arm/v7` (Raspberry Pi, IoT devices) | |
| ### Environment Variables | |
| The Docker image will include `DEPLOYSTACK_FRONTEND_VERSION` environment variable set to the current version. | |
| ## Release notes: | |
| ${{ steps.extract-release-notes.outputs.release_notes }} | |
| labels: | | |
| frontend | |
| release | |
| automated pr | |
| draft: false | |
| - name: Show PR link | |
| if: ${{ steps.cpr.outputs.pull-request-url }} | |
| run: | | |
| echo "Frontend Release v${{ steps.package-version.outputs.current-version}}' pull request - ${{ steps.cpr.outputs.pull-request-url }}" |