Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 91 additions & 12 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ on:
push:
branches:
- main
- develop
- release-candidate

permissions:
contents: write
packages: write
pull-requests: read

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
Expand All @@ -18,6 +21,8 @@ jobs:
outputs:
version: ${{ steps.version.outputs.new_version }}
should_release: ${{ steps.version.outputs.should_release }}
is_prerelease: ${{ steps.version.outputs.is_prerelease }}
release_channel: ${{ steps.version.outputs.release_channel }}
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -45,23 +50,83 @@ jobs:

- name: Generate version
id: version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get last tag
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
echo "Last tag: $LAST_TAG"
BRANCH="${GITHUB_REF_NAME}"
LAST_STABLE=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1)
if [ -z "$LAST_STABLE" ]; then
LAST_STABLE="v0.0.0"
fi

VERSION=${LAST_STABLE#v}
MAJOR=$(echo "$VERSION" | cut -d. -f1)
MINOR=$(echo "$VERSION" | cut -d. -f2)
PATCH=$(echo "$VERSION" | cut -d. -f3)

BUMP="patch"
IS_PRERELEASE="true"
CHANNEL="alpha"

if [ "$BRANCH" = "develop" ]; then
LAST_ALPHA=$(git tag -l "v${MAJOR}.${MINOR}.${PATCH}.alpha.*" | grep -E "^v${MAJOR}\.${MINOR}\.${PATCH}\.alpha\.[0-9]+$" | sort -V | tail -n1)
if [ -n "$LAST_ALPHA" ]; then
ALPHA_N=${LAST_ALPHA##*.}
ALPHA_N=$((ALPHA_N + 1))
else
ALPHA_N=1
fi
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}.alpha.${ALPHA_N}"
CHANNEL="alpha"
IS_PRERELEASE="true"
elif [ "$BRANCH" = "release-candidate" ]; then
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}.beta.${GITHUB_RUN_NUMBER}.${GITHUB_RUN_ATTEMPT}.${GITHUB_RUN_ID}"
CHANNEL="beta"
IS_PRERELEASE="true"
else
PR_NUMBER=$(gh api "repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/pulls" --jq '.[0].number' 2>/dev/null || true)

# Parse version
VERSION=${LAST_TAG#v}
MAJOR=$(echo $VERSION | cut -d. -f1)
MINOR=$(echo $VERSION | cut -d. -f2)
PATCH=$(echo $VERSION | cut -d. -f3)
if [ -z "$PR_NUMBER" ]; then
echo "ERROR: Could not find PR associated with commit ${GITHUB_SHA} on main."
echo "Only merges from release-candidate with bump label are allowed."
exit 1
fi

# Increment patch version
PATCH=$((PATCH + 1))
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
LABELS=$(gh api "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels" --jq '.[].name' 2>/dev/null || true)
Comment thread
miguel-l-b marked this conversation as resolved.
Resolved
if echo "$LABELS" | grep -Eq '^(major|semver:major)$'; then
BUMP="major"
elif echo "$LABELS" | grep -Eq '^(minor|semver:minor)$'; then
BUMP="minor"
elif echo "$LABELS" | grep -Eq '^(patch|semver:patch)$'; then
BUMP="patch"
else
echo "ERROR: PR #${PR_NUMBER} is missing bump label (major/minor/patch or semver:major/minor/patch)."
exit 1
fi

if [ "$BUMP" = "major" ]; then
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
elif [ "$BUMP" = "minor" ]; then
MINOR=$((MINOR + 1))
PATCH=0
else
PATCH=$((PATCH + 1))
fi

NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
CHANNEL="stable"
IS_PRERELEASE="false"
fi

echo "Branch: $BRANCH"
echo "Channel: $CHANNEL"
echo "Last stable: $LAST_STABLE"
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
echo "should_release=true" >> $GITHUB_OUTPUT
echo "is_prerelease=${IS_PRERELEASE}" >> $GITHUB_OUTPUT
echo "release_channel=${CHANNEL}" >> $GITHUB_OUTPUT
echo "New version: $NEW_VERSION"

- name: Upload build artifacts
Expand Down Expand Up @@ -95,10 +160,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ needs.build.outputs.version }}"
IS_PRERELEASE="${{ needs.build.outputs.is_prerelease }}"
CHANNEL="${{ needs.build.outputs.release_channel }}"
NOTES=$(cat <<'EOF'
## Changelog
- Build date: ${{ github.event.head_commit.timestamp }}
- Commit: ${{ github.sha }}
- Branch: ${{ github.ref_name }}
- Channel: ${{ needs.build.outputs.release_channel }}

### Assets
- **wallpaper**: Executável do aplicativo
Expand All @@ -108,7 +177,17 @@ jobs:
)

if ! gh release view "$VERSION" >/dev/null 2>&1; then
gh release create "$VERSION" --title "Release $VERSION" --notes "$NOTES"
if [ "$IS_PRERELEASE" = "true" ]; then
gh release create "$VERSION" --title "Release $VERSION" --notes "$NOTES" --prerelease
else
gh release create "$VERSION" --title "Release $VERSION" --notes "$NOTES"
fi
else
if [ "$IS_PRERELEASE" = "true" ]; then
gh release edit "$VERSION" --prerelease --title "Release $VERSION" --notes "$NOTES"
else
gh release edit "$VERSION" --latest --title "Release $VERSION" --notes "$NOTES"
fi
fi

ASSETS=()
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/main-pr-guard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Main PR Guard

on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
- edited

permissions:
contents: read
pull-requests: read

jobs:
guard:
runs-on: ubuntu-latest
steps:
- name: Enforce source branch and semver label
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
const headRef = pr.head.ref;
const allowedHeadRef = 'release-candidate';

if (headRef !== allowedHeadRef) {
core.setFailed(`PRs to main must come from '${allowedHeadRef}', got '${headRef}'.`);
return;
}

const labelNames = (pr.labels || []).map((l) => l.name);
const allowed = new Set(['major', 'minor', 'patch', 'semver:major', 'semver:minor', 'semver:patch']);
const matches = labelNames.filter((name) => allowed.has(name));

if (matches.length === 0) {
core.setFailed('Missing release bump label on PR. Add one of: major, minor, patch (or semver:major|minor|patch).');
return;
}

if (matches.length > 1) {
core.setFailed(`Use only one bump label. Found: ${matches.join(', ')}`);
return;
}

core.info(`PR guard OK. Source: ${headRef}, bump label: ${matches[0]}`);
2 changes: 2 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
pull_request:
branches:
- main
- develop
push:
branches:
- develop
- release-candidate

jobs:
build:
Expand Down
40 changes: 36 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,45 @@ This project is licensed under the MIT License. See the LICENSE file for details

## 🤝 Contributing

Contributions are welcome! Please:
Contributions are welcome. This project uses a strict release flow:

1. Create your feature/fix branch from `develop`
2. Open a PR to `develop`
3. After validation, changes are promoted to `release-candidate`
Comment thread
miguel-l-b marked this conversation as resolved.
Resolved
4. Only PRs from `release-candidate` are allowed into `main`

### Release Flow Rules

- Push to `develop` generates an **alpha** pre-release version:
- Format: `vX.Y.Z.alpha.N`
- Push to `release-candidate` generates a **beta** pre-release version:
- Format: `vX.Y.Z.beta.A.B.C`
- Push/merge to `main` generates a **stable** release version:
- Format: `vX.Y.Z`

### Main Merge Policy

- Target branch `main` only accepts PRs coming from `release-candidate`
- PR must contain exactly one bump label:
- `patch` or `semver:patch`
- `minor` or `semver:minor`
- `major` or `semver:major`

### Version Bump Semantics (main)

- `patch`: `X.Y.Z` -> `X.Y.(Z+1)`
- `minor`: `X.Y.Z` -> `X.(Y+1).0`
- `major`: `X.Y.Z` -> `(X+1).0.0`

### Suggested Contribution Steps

1. Fork the repository
2. Create a branch for your feature (`git checkout -b feature/MyFeature`)
2. Create a branch from `develop` (`git checkout -b feature/MyFeature develop`)
3. Commit your changes (`git commit -am 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/MyFeature`)
5. Open a Pull Request
4. Push your branch (`git push origin feature/MyFeature`)
5. Open a PR to `develop`
6. Promote tested changes to `release-candidate`
7. Open PR from `release-candidate` to `main` with one required bump label

### Development Guidelines

Expand Down
68 changes: 68 additions & 0 deletions templates/aurora-waves.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Aurora Waves</title>
<style>
html,
body {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: radial-gradient(circle at 50% 20%, #101b32, #04060d 72%);
}

canvas {
display: block;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<canvas id="aurora"></canvas>
<script>
const canvas = document.getElementById("aurora");
const ctx = canvas.getContext("2d");
let t = 0;

function resize() {
canvas.width = innerWidth;
canvas.height = innerHeight;
}

function drawWave(offset, color, amp, freq, speed, thick) {
ctx.beginPath();
for (let x = 0; x <= canvas.width; x += 2) {
const y =
canvas.height * 0.5 +
Math.sin(x * freq + t * speed + offset) * amp +
Math.sin(x * (freq * 0.37) - t * speed * 0.8) * (amp * 0.4);
if (x === 0) ctx.moveTo(x, y);
else ctx.lineTo(x, y);
}
ctx.lineWidth = thick;
ctx.strokeStyle = color;
ctx.stroke();
}

function frame() {
t += 0.016;
ctx.fillStyle = "rgba(4, 6, 13, 0.08)";
ctx.fillRect(0, 0, canvas.width, canvas.height);

drawWave(0.0, "rgba(84, 255, 214, 0.25)", 100, 0.007, 1.5, 44);
drawWave(1.2, "rgba(89, 164, 255, 0.22)", 130, 0.006, 1.1, 58);
drawWave(2.4, "rgba(201, 122, 255, 0.20)", 85, 0.009, 1.8, 36);

requestAnimationFrame(frame);
}

resize();
window.addEventListener("resize", resize);
requestAnimationFrame(frame);
</script>
</body>
</html>
Loading
Loading