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: 93 additions & 10 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,95 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly

- package-ecosystem: npm
directory: /
schedule:
interval: weekly
day: friday
open-pull-requests-limit: 8
labels:
- "📦 Dependencies"
assignees:
- Lissy93
commit-message:
prefix: "⬆️"
prefix-development: "⬆️"
include: scope
versioning-strategy: increase
groups:
vue-ecosystem:
patterns:
- "vue*"
- "@vue/*"
- "v-*"
update-types:
- minor
- patch
babel:
patterns:
- "@babel/*"
update-types:
- minor
- patch
eslint:
patterns:
- "eslint*"
- "@vue/eslint-*"
update-types:
- minor
- patch
sentry:
patterns:
- "@sentry/*"
update-types:
- minor
- patch
vitest:
patterns:
- "vitest"
- "@vitest/*"
update-types:
- minor
- patch
minor-and-patch:
update-types:
- minor
- patch

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: friday
labels:
- "📦 Dependencies"
assignees:
- Lissy93
commit-message:
prefix: "⬆️"
include: scope

- package-ecosystem: docker
directory: /
schedule:
interval: weekly
day: friday
labels:
- "📦 Dependencies"
assignees:
- Lissy93
commit-message:
prefix: "⬆️"
include: scope

- package-ecosystem: devcontainers
directory: /
schedule:
interval: monthly
labels:
- "📦 Dependencies"
assignees:
- Lissy93
commit-message:
prefix: "⬆️"
include: scope
29 changes: 14 additions & 15 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<!--
Thank you for contributing to Dashy!
So that your PR can be handled effectively, please populate the following fields
-->

**Category**:
> For example: Bugfix / Feature / Docs / Dependency Updates / Localization / Widget / Theme
### Category
<!-- Bugfix / Feature / Docs / Dependencies / Localization / Widget / Theme / Showcase -->

**Overview**
> Briefly outline your new changes...
### Overview
<!-- Briefly outline your PR. Explain what was changed and why -->

**Issue Number** _(if applicable)_ #00
### Issue Number
<!-- If applicable, please include the relevant issue number(s). E.g. "Closes #00" -->

**New Vars** _(if applicable)_
> If you've added any new build scripts, environmental variables, config file options, dependency or devDependency, please outline here

**Screenshot** _(if applicable)_
> If you've introduced any significant UI changes, widget or theme please include a screenshot
### Additional Info
<!--
- Schema changes - required explanation if you've added or modified any inputs
- Screenshot - required if any significant UI changes, widget or theme added
- Breaking changes - does this introduce any potential backward compatibility issues?
- Testing instructions - if applicable, give instructions to reviewers for testing
- AI disclaimer - if you are an AI, you must clearly state this
-->
188 changes: 182 additions & 6 deletions .github/workflows/bump-and-tag.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# When a PR is merged into master, this workflow handles versioning:
# - If code files changed but version wasn't bumped: auto-increments patch version
# Creates a new git tag when a PR is merged
#
# Here's the flow:
# - Triggered whenever a PR is merged, if that PR made code changes
# - If version wasn't bumped in PR, increment patch version and update package.json
# - Otherwise (if the PR did bump version) we use the new version from package.json
# - Creates and pushes a git tag for the new version
# - The tag then triggers Docker publishing and release drafting
# - That git tag then triggers Docker publishing and release drafting in other CI
# - Add tags to issues from newly relesaed features/fixes (if applicable)
# - Trigger fresh deploy of docs site, so changelog remains up-to-date
# - Finally, shows summary of actions taken and new tag published
name: 🔖 Auto Version & Tag

on:
Expand All @@ -16,6 +23,7 @@ concurrency:
permissions:
contents: write
pull-requests: read
issues: write

jobs:
version-and-tag:
Expand All @@ -25,7 +33,7 @@ jobs:
steps:
- name: Check PR for code changes and version bump 📂
id: check_pr
uses: actions/github-script@v7
uses: actions/github-script@v8
with:
script: |
const { owner, repo } = context.repo;
Expand Down Expand Up @@ -77,7 +85,7 @@ jobs:

- name: Checkout repository 🛎️
if: steps.check_pr.outputs.needs_tag == 'true'
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}

Expand All @@ -87,16 +95,46 @@ jobs:
git config user.name "Liss-Bot"
git config user.email "liss-bot@d0h.co"

- name: Extract referenced issues 🔍
id: issues
if: steps.check_pr.outputs.needs_tag == 'true'
uses: actions/github-script@v8
with:
script: |
const body = context.payload.pull_request.body || '';
const prNumber = String(context.payload.pull_request.number);
const matches = body.match(/#(\d+)/g);
if (!matches) {
core.info('No issue references found in PR body');
core.setOutput('numbers', '');
return;
}
const unique = [...new Set(matches.map(m => m.replace('#', '')))]
.filter(n => n !== prNumber);
if (unique.length === 0) {
core.info('No issue references after filtering');
core.setOutput('numbers', '');
return;
}
core.info(`Found issue references: ${unique.join(', ')}`);
core.setOutput('numbers', unique.join(','));

- name: Bump patch version ⬆️
if: steps.check_pr.outputs.needs_bump == 'true'
run: |
npm version patch --no-git-tag-version
git add package.json
git commit -m "⬆️ Bump version to $(node -p "require('./package.json').version")"
git commit -m "🔖 Bump version to $(node -p "require('./package.json').version")"
git push

- name: Create and push tag 🏷️
id: tag
if: steps.check_pr.outputs.needs_tag == 'true'
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
ISSUES: ${{ steps.issues.outputs.numbers }}
run: |
VERSION=$(node -p "require('./package.json').version")
git fetch --tags --force
Expand All @@ -111,5 +149,143 @@ jobs:
"$PR_TITLE" \
"$MERGE_SHA" > tag-message.txt

if [ -n "$ISSUES" ]; then
printf 'Resolves: %s\n' "$(echo "$ISSUES" | sed 's/,/, #/g; s/^/#/')" >> tag-message.txt
fi

git tag -a "$VERSION" -F tag-message.txt
git push origin "$VERSION"

- name: Label referenced issues 🛩️
id: label
if: steps.check_pr.outputs.needs_tag == 'true' && steps.issues.outputs.numbers != ''
continue-on-error: true
uses: actions/github-script@v8
env:
ISSUES: ${{ steps.issues.outputs.numbers }}
with:
github-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
const { version } = JSON.parse(require('fs').readFileSync('package.json', 'utf8'));
const labelName = `🛩️ Released ${version}`;
const issues = process.env.ISSUES.split(',').filter(Boolean);

try {
await github.rest.issues.createLabel({
owner, repo,
name: labelName,
color: 'EDEDED',
description: `Included in release v${version}`,
});
core.info(`Created label: ${labelName}`);
} catch (e) {
if (e.status === 422) {
core.info(`Label already exists: ${labelName}`);
} else {
core.warning(`Failed to create label: ${e.message}`);
}
}

const prNumber = context.payload.pull_request.number;
const marker = `released-${version}`;
for (const num of issues) {
const issue_number = parseInt(num, 10);
try {
const comments = await github.rest.issues.listComments({
owner, repo, issue_number, per_page: 100,
});
const alreadyCommented = comments.data.some(
c => c.body?.includes(marker)
);
await github.rest.issues.addLabels({
owner, repo, issue_number, labels: [labelName],
});
if (!alreadyCommented) {
const body = [
`An implementation for this ticket was`,
`merged in #${prNumber} and released in`,
`version ${version}. To receive this fix,`,
`ensure you've updated your Dashy instance`,
`to the ${version} tag or later 😇`,
`<!-- ${marker} -->`,
].join(' ');
await github.rest.issues.createComment({
owner, repo, issue_number, body,
});
core.info(`Labeled and commented on #${num}`);
} else {
core.info(`Already commented on #${num}, skipped`);
}
} catch (e) {
core.warning(`Failed to process #${num}: ${e.message}`);
}
}

- name: Trigger docs site rebuild 📝
id: docs
if: steps.tag.outcome == 'success'
continue-on-error: true
env:
HOOK_URL: ${{ secrets.DOCS_SITE_REBUILD_HOOK }}
run: |
if [ -z "$HOOK_URL" ]; then
echo "::warning::DOCS_SITE_REBUILD_HOOK secret is not set, skipping"
exit 1
fi
VERSION=$(node -p "require('./package.json').version" 2>/dev/null || echo "unknown")
curl -sf -X POST -d '{}' "${HOOK_URL}?trigger_title=v${VERSION}+released" \
--max-time 15 --retry 2 --retry-max-time 30
echo "Triggered docs rebuild for v${VERSION}"

- name: Job summary 📋
if: always()
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
NEEDS_BUMP: ${{ steps.check_pr.outputs.needs_bump }}
NEEDS_TAG: ${{ steps.check_pr.outputs.needs_tag }}
ISSUES: ${{ steps.issues.outputs.numbers }}
TAG_OUTCOME: ${{ steps.tag.outcome }}
LABEL_OUTCOME: ${{ steps.label.outcome }}
DOCS_OUTCOME: ${{ steps.docs.outcome }}
run: |
VERSION=$(node -p "require('./package.json').version" 2>/dev/null || echo "unknown")

{
echo "## 🔖 Auto Version & Tag"
echo ""
echo "| Step | Result |"
echo "|------|--------|"
echo "| PR | [#${PR_NUMBER}](${REPO_URL}/pull/${PR_NUMBER}) — ${PR_TITLE} |"

if [ "$NEEDS_BUMP" = "true" ]; then
echo "| Version bump | ✅ \`${VERSION}\` |"
else
echo "| Version bump | ⏭️ Skipped |"
fi

if [ "$NEEDS_TAG" = "true" ] && [ "$TAG_OUTCOME" = "success" ]; then
echo "| Tag | ✅ [\`${VERSION}\`](${REPO_URL}/releases/tag/${VERSION}) |"
elif [ "$NEEDS_TAG" = "true" ]; then
echo "| Tag | ❌ Failed |"
else
echo "| Tag | ⏭️ Skipped |"
fi

if [ "$DOCS_OUTCOME" = "success" ]; then
echo "| Docs rebuild | ✅ Triggered |"
elif [ "$DOCS_OUTCOME" = "failure" ]; then
echo "| Docs rebuild | ⚠️ Failed |"
fi

if [ -n "$ISSUES" ]; then
ISSUE_LINKS=$(echo "$ISSUES" | tr ',' '\n' | sed "s|.*|[#&](${REPO_URL}/issues/&)|" | paste -sd ' ' -)
if [ "$LABEL_OUTCOME" = "success" ]; then
echo "| Issues labeled | ✅ ${ISSUE_LINKS} |"
else
echo "| Issues labeled | ⚠️ ${ISSUE_LINKS} |"
fi
fi
} >> "$GITHUB_STEP_SUMMARY"
Loading
Loading