chore(frontend): bump @commitlint/cli from 19.8.1 to 20.1.0 in /services/frontend #143
Workflow file for this run
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 | |
on: | |
pull_request: | |
types: [closed] | |
branches: [main] | |
paths: | |
- 'services/frontend/**' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
release: | |
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'frontend') && contains(github.event.pull_request.labels.*.name, 'release') | |
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@v5 | |
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: Fix Rollup platform package | |
run: | | |
npm install @rollup/rollup-linux-x64-gnu --save-optional || echo "Rollup package already installed" | |
- name: Create Release | |
working-directory: services/frontend | |
env: | |
GITHUB_TOKEN: ${{ secrets.APP_INSTALLATION_TOKEN }} | |
run: | | |
# Let release-it handle the release process properly | |
npm run release -- --ci --verbose --no-git.requireCleanWorkingDir --no-increment | |
- name: Get 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 (excluding the current one) | |
LATEST_TAG=$(git tag --list "frontend-v*" --sort=-version:refname | grep -v "frontend-v${VERSION}" | head -1) | |
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: Update .env with version | |
working-directory: services/frontend | |
run: | | |
if [ ! -f .env ]; then | |
touch .env | |
fi | |
if grep -q "VITE_DEPLOYSTACK_APP_VERSION" .env; then | |
sed -i "s/VITE_DEPLOYSTACK_APP_VERSION=.*/VITE_DEPLOYSTACK_APP_VERSION=${{ steps.package-version.outputs.current-version }}/" .env | |
else | |
echo "VITE_DEPLOYSTACK_APP_VERSION=${{ steps.package-version.outputs.current-version }}" >> .env | |
fi | |
echo "Updated .env file:" | |
grep VITE_DEPLOYSTACK_APP_VERSION .env | |
- name: Build frontend | |
working-directory: services/frontend | |
env: | |
VITE_DEPLOYSTACK_APP_VERSION: ${{ steps.package-version.outputs.current-version }} | |
run: | | |
npm run build || { | |
echo "Build failed, attempting rollup fix..." | |
cd ../.. | |
npm install @rollup/rollup-linux-x64-gnu --save-optional --force | |
cd services/frontend | |
npm run build | |
} | |
ls -al ./dist | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./services/frontend/Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: true | |
tags: | | |
deploystack/frontend:latest | |
deploystack/frontend:v${{ steps.package-version.outputs.current-version }} | |
build-args: | | |
DEPLOYSTACK_FRONTEND_VERSION=${{ steps.package-version.outputs.current-version }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |