-
Notifications
You must be signed in to change notification settings - Fork 2
Dev #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev #35
Changes from 66 commits
f09f9f9
04765b6
f95f705
22d516a
ef595c2
83f6a8e
3804a90
b5700aa
1c00472
a64e349
d2dd113
8f33c2c
cd9c132
59e3a7d
aaf2208
e616e05
b020927
2aec5b1
69ed0c6
595d2c0
954d76c
4f38817
db0511f
699d256
327e999
9c9405a
6628c9d
12698ac
0df599a
ac26496
c579a3e
d3c38a2
3a6cb0b
156ce53
33e14cd
813aed6
609544b
657c79c
959edf4
6d73a98
944ec63
557e4a5
816eb0f
5f8713b
3f6481f
b068104
61bd400
3b8c825
eb65308
a4ebdcb
f78ab77
27a8e24
f8a9519
f23128a
98a0d63
269376f
f3a834d
3018393
4592326
2daa6d2
f8a8e73
4fd8dd0
3201d6a
ada5296
48da57c
d2db2e9
5e91d69
fede229
e01e36d
dd240ba
4478f2b
977b900
b8ee347
8435004
1f91f50
918cfa3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,25 +2,25 @@ name: Release | |
|
|
||
| on: | ||
| push: | ||
| branches: [ master ] | ||
| branches: | ||
| - master | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Version to release (e.g., 1.2.0, patch, minor, major)' | ||
| required: true | ||
| default: 'patch' | ||
|
|
||
| concurrency: | ||
| group: release-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch' | ||
| if: github.ref == 'refs/heads/master' | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| outputs: | ||
| new_version: ${{ steps.new_version.outputs.new_version }} | ||
| version_number: ${{ steps.new_version.outputs.version_number }} | ||
| new_version: ${{ steps.version.outputs.new_version }} | ||
| version_number: ${{ steps.version.outputs.version_number }} | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
@@ -31,167 +31,112 @@ jobs: | |
| - name: Setup Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: latest | ||
| bun-version: 1.3.10 | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Get version | ||
| - name: Resolve version | ||
| id: version | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| VERSION="${{ github.event.inputs.version }}" | ||
| else | ||
| # Auto-determine version based on commit messages since last tag | ||
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | ||
| if [ -n "$LAST_TAG" ]; then | ||
| LOG_CMD="git log --format=%s $LAST_TAG..HEAD" | ||
| else | ||
| # No tags yet: inspect the last 50 commits (avoids HEAD~N issues on shallow/short histories) | ||
| LOG_CMD="git log --format=%s -n 50" | ||
| fi | ||
|
|
||
| if eval "$LOG_CMD" | grep -Eq 'BREAKING CHANGE|^feat\([^)]+\)?!'; then | ||
| VERSION="major" | ||
| elif eval "$LOG_CMD" | grep -Eq '^feat\([^)]+\)?:'; then | ||
| VERSION="minor" | ||
| else | ||
| VERSION="patch" | ||
| fi | ||
| VERSION=$(node -p "require('./package.json').version") | ||
| if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.-]+)?$ ]]; then | ||
| echo "Invalid package.json version: $VERSION" | ||
| exit 1 | ||
| fi | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "new_version=v$VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "version_number=$VERSION" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Update version | ||
| id: new_version | ||
| - name: Verify release metadata | ||
| run: | | ||
| NEW_VERSION=$(npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version) | ||
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | ||
| echo "version_number=${NEW_VERSION#v}" >> $GITHUB_OUTPUT | ||
| bun run version:check | ||
| bun run docs:validate | ||
| VERSION="${{ steps.version.outputs.version_number }}" | ||
| grep -F "## [${VERSION}]" CHANGELOG.md >/dev/null | ||
|
|
||
| - name: Type check | ||
| run: bun run tsc --noEmit | ||
|
|
||
| - name: Run test suite | ||
| run: bun test | ||
|
|
||
| - name: Build application | ||
| run: bun run build | ||
|
|
||
| - name: Update changelog | ||
| run: | | ||
| # Create or update CHANGELOG.md | ||
| if [ ! -f CHANGELOG.md ]; then | ||
| echo "# CHANGELOG" > CHANGELOG.md | ||
| echo "" >> CHANGELOG.md | ||
| fi | ||
|
|
||
| # Add new version entry | ||
| DATE=$(date +%Y-%m-%d) | ||
| sed -i "3i\\## [${{ steps.new_version.outputs.version_number }}] - $DATE\\n" CHANGELOG.md | ||
|
|
||
| # Add commit messages since last tag | ||
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | ||
| if [ -n "$LAST_TAG" ]; then | ||
| echo "### Changes since $LAST_TAG:" >> temp_changelog.md | ||
| git log --pretty=format:"- %s" $LAST_TAG..HEAD >> temp_changelog.md | ||
| else | ||
| echo "### Changes:" >> temp_changelog.md | ||
| git log --pretty=format:"- %s" -n 10 >> temp_changelog.md | ||
| fi | ||
| echo "" >> temp_changelog.md | ||
|
|
||
| # Insert changes into changelog | ||
| sed -i "/## \[${{ steps.new_version.outputs.version_number }}\]/r temp_changelog.md" CHANGELOG.md | ||
| rm temp_changelog.md | ||
|
|
||
| - name: Create release archive | ||
| run: | | ||
| mkdir -p release | ||
|
|
||
| # Create source archive | ||
| tar -czf release/igloo-server-${{ steps.new_version.outputs.version_number }}-src.tar.gz \ | ||
|
|
||
| tar -czf release/igloo-server-${{ steps.version.outputs.version_number }}-src.tar.gz \ | ||
| --exclude=node_modules \ | ||
| --exclude=.git \ | ||
| --exclude=release \ | ||
| --exclude=static/app.js \ | ||
| --exclude=static/styles.css \ | ||
| . | ||
|
|
||
| # Create binary archive with built assets | ||
| tar -czf release/igloo-server-${{ steps.new_version.outputs.version_number }}.tar.gz \ | ||
|
|
||
| tar -czf release/igloo-server-${{ steps.version.outputs.version_number }}.tar.gz \ | ||
| --exclude=node_modules \ | ||
| --exclude=.git \ | ||
| --exclude=release \ | ||
| --exclude=frontend \ | ||
| src static package.json bun.lock tsconfig.json dockerfile compose.yml README.md LICENSE | ||
| src static package.json bun.lock tsconfig.json Dockerfile compose.yml README.md LICENSE docs/openapi | ||
|
|
||
| - name: Create release tag | ||
| run: | | ||
| # Create git tag for release (works with branch protection) | ||
| # Note: Version changes are not committed back to master due to branch protection | ||
| # The release archives will contain the correct versions | ||
| git tag ${{ steps.new_version.outputs.new_version }} | ||
| git push origin ${{ steps.new_version.outputs.new_version }} | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: actions/create-release@v1 | ||
| id: create_release | ||
| TAG="${{ steps.version.outputs.new_version }}" | ||
| git fetch --tags origin | ||
| if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then | ||
| echo "Tag ${TAG} already exists, skipping tag creation" | ||
| else | ||
| git tag "${TAG}" | ||
| git push origin "${TAG}" | ||
| fi | ||
|
AustinKelsay marked this conversation as resolved.
|
||
|
|
||
| - name: Create GitHub release and upload assets | ||
| uses: softprops/action-gh-release@v2 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag_name: ${{ steps.new_version.outputs.new_version }} | ||
| release_name: Release ${{ steps.new_version.outputs.new_version }} | ||
| tag_name: ${{ steps.version.outputs.new_version }} | ||
| name: Release ${{ steps.version.outputs.new_version }} | ||
| body: | | ||
| ## Changes in ${{ steps.new_version.outputs.new_version }} | ||
| ## Changes in ${{ steps.version.outputs.new_version }} | ||
|
|
||
| See [CHANGELOG.md](https://github.com/FROSTR-ORG/igloo-server/blob/master/CHANGELOG.md) for full details. | ||
|
|
||
| ### Installation | ||
|
|
||
| **Docker (Recommended)**: | ||
| ```bash | ||
| docker pull ghcr.io/frostr-org/igloo-server:${{ steps.new_version.outputs.version_number }} | ||
| docker pull ghcr.io/frostr-org/igloo-server:${{ steps.version.outputs.version_number }} | ||
| ``` | ||
|
|
||
| **From Source**: | ||
| ```bash | ||
| curl -L https://github.com/FROSTR-ORG/igloo-server/archive/${{ steps.new_version.outputs.new_version }}.tar.gz | tar -xz | ||
| cd igloo-server-${{ steps.new_version.outputs.version_number }} | ||
| curl -L https://github.com/FROSTR-ORG/igloo-server/archive/${{ steps.version.outputs.new_version }}.tar.gz | tar -xz | ||
| cd igloo-server-${{ steps.version.outputs.version_number }} | ||
| bun install | ||
| bun run build | ||
| bun run start | ||
| ``` | ||
| draft: false | ||
| prerelease: false | ||
|
|
||
| - name: Upload source archive | ||
| uses: actions/upload-release-asset@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
| asset_path: ./release/igloo-server-${{ steps.new_version.outputs.version_number }}-src.tar.gz | ||
| asset_name: igloo-server-${{ steps.new_version.outputs.version_number }}-src.tar.gz | ||
| asset_content_type: application/gzip | ||
|
|
||
| - name: Upload binary archive | ||
| uses: actions/upload-release-asset@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
| asset_path: ./release/igloo-server-${{ steps.new_version.outputs.version_number }}.tar.gz | ||
| asset_name: igloo-server-${{ steps.new_version.outputs.version_number }}.tar.gz | ||
| asset_content_type: application/gzip | ||
| files: | | ||
| ./release/igloo-server-${{ steps.version.outputs.version_number }}-src.tar.gz | ||
| ./release/igloo-server-${{ steps.version.outputs.version_number }}.tar.gz | ||
|
|
||
| docker: | ||
| runs-on: ubuntu-latest | ||
| needs: release | ||
|
|
||
| permissions: | ||
| packages: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: master | ||
| ref: refs/tags/${{ needs.release.outputs.new_version }} | ||
|
Comment on lines
+132
to
+139
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n .github/workflows/release.yml | head -160 | tail -50Repository: FROSTR-ORG/igloo-server Length of output: 1977 🏁 Script executed: # Get the full context of the docker job
sed -n '100,150p' .github/workflows/release.ymlRepository: FROSTR-ORG/igloo-server Length of output: 1682 🏁 Script executed: # Check if there are any other permission patterns in the file
grep -n "permissions:" .github/workflows/release.yml -A 3Repository: FROSTR-ORG/igloo-server Length of output: 227 🌐 Web query:
💡 Result:
permissions:
contents: readOtherwise the checkout step can fail because any permission you don’t list is set to Notes:
Citations:
🏁 Script executed: # Check if there are any comments or documentation in the workflow file itself
grep -i "permission\|token\|contents\|read" .github/workflows/release.yml | head -20Repository: FROSTR-ORG/igloo-server Length of output: 438 Restore repository read permission in the Docker job. Job-level 🔧 Minimal fix docker:
runs-on: ubuntu-latest
needs: release
permissions:
+ contents: read
packages: write🤖 Prompt for AI Agents |
||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
@@ -219,7 +164,7 @@ jobs: | |
| org.opencontainers.image.version=${{ needs.release.outputs.version_number }} | ||
| org.opencontainers.image.revision=${{ github.sha }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Build and push Umbrel Docker image | ||
| uses: docker/build-push-action@v5 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
git ls-files ".github/workflows/*.yml"Repository: FROSTR-ORG/igloo-server
Length of output: 154
🏁 Script executed:
cat -n ".github/workflows/release.yml"Repository: FROSTR-ORG/igloo-server
Length of output: 7399
Don't trigger release workflow on every push to master without versioning changes.
Every push to
masterwill execute the release job. Whenpackage.jsonhasn't changed, the version is reused from the previous release. At lines 89–90, tag creation is skipped if the tag already exists, but the job continues executing: it builds artifacts, and at lines 96–127 the release action creates or updates a release for that existing tag. This means multiple commits can publish under the same version tag—each overwriting the previous release's artifacts—making it impossible to track which commit corresponds to a released version.🤖 Prompt for AI Agents