1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

ci: use gh app

This commit is contained in:
bbedward
2025-11-30 01:42:15 -05:00
parent c53836040f
commit d62ef635a7
3 changed files with 91 additions and 98 deletions

View File

@@ -132,19 +132,26 @@ jobs:
runs-on: ubuntu-latest
needs: build-core
steps:
- name: Create GitHub App token
id: app_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
token: ${{ steps.app_token.outputs.token }}
fetch-depth: 0
- name: Update VERSION
env:
GH_PAT: ${{ secrets.GH_PAT }}
GH_TOKEN: ${{ steps.app_token.outputs.token }}
run: |
set -euo pipefail
git config user.name "dms-ci"
git config user.email "dms-ci@users.noreply.github.com"
git config user.name "dms-ci[bot]"
git config user.email "dms-ci[bot]@users.noreply.github.com"
version="${GITHUB_REF#refs/tags/}"
echo "Updating to version: $version"
@@ -153,11 +160,12 @@ jobs:
if ! git diff --cached --quiet; then
git commit -m "chore: bump version to $version"
git push https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}.git HEAD:master
git pull --rebase origin master
git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git HEAD:master
fi
git tag -f "${version}"
git push -f https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}.git "${version}"
git push -f https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git "${version}"
release:
runs-on: ubuntu-24.04

View File

@@ -9,14 +9,25 @@ on:
branches:
- master
permissions:
contents: write
jobs:
update-vendor-hash:
runs-on: ubuntu-latest
steps:
- name: Create GitHub App token
id: app_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app_token.outputs.token }}
- name: Install Nix
uses: cachix/install-nix-action@v31
@@ -24,56 +35,32 @@ jobs:
- name: Update vendorHash in flake.nix
run: |
set -euo pipefail
# Try to build and capture the expected hash from error message
echo "Attempting nix build to get new vendorHash..."
if output=$(nix build .#dmsCli 2>&1); then
echo "Build succeeded, no hash update needed"
exit 0
fi
# Extract the expected hash from the error message
new_hash=$(echo "$output" | grep -oP "got:\s+\K\S+" | head -n1)
if [ -z "$new_hash" ]; then
echo "Could not extract new vendorHash from build output"
echo "Build output:"
echo "$output"
exit 1
fi
echo "New vendorHash: $new_hash"
# Get current hash from flake.nix
[ -n "$new_hash" ] || { echo "Could not extract new vendorHash"; echo "$output"; exit 1; }
current_hash=$(grep -oP 'vendorHash = "\K[^"]+' flake.nix)
echo "Current vendorHash: $current_hash"
if [ "$current_hash" = "$new_hash" ]; then
echo "vendorHash is already up to date"
exit 0
fi
# Update the hash in flake.nix
[ "$current_hash" = "$new_hash" ] && { echo "vendorHash already up to date"; exit 0; }
sed -i "s|vendorHash = \"$current_hash\"|vendorHash = \"$new_hash\"|" flake.nix
# Verify the build works with the new hash
echo "Verifying build with new vendorHash..."
nix build .#dmsCli
echo "vendorHash updated successfully!"
- name: Commit and push vendorHash update
env:
GH_PAT: ${{ secrets.GH_PAT }}
GH_TOKEN: ${{ steps.app_token.outputs.token }}
run: |
set -euo pipefail
if ! git diff --quiet flake.nix; then
git config user.name "dms-ci"
git config user.email "dms-ci@users.noreply.github.com"
git config user.name "dms-ci[bot]"
git config user.email "dms-ci[bot]@users.noreply.github.com"
git add flake.nix
git commit -m "nix: update vendorHash for go.mod changes" || exit 0
git push https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}.git HEAD:master
git pull --rebase origin master
git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git HEAD:master
else
echo "No changes to flake.nix"
fi

View File

@@ -28,9 +28,9 @@ Item {
readonly property real wing: gothEnabled ? barWindow._wingR : 0
readonly property real rt: (barConfig?.squareCorners ?? false) ? 0 : Theme.cornerRadius
readonly property string mainPath: { width; height; return generatePathForPosition(); }
readonly property string borderFullPath: { width; height; return generateBorderFullPath(); }
readonly property string borderEdgePath: { width; height; return generateBorderEdgePath(); }
readonly property string mainPath: generatePathForPosition(width, height)
readonly property string borderFullPath: generateBorderFullPath(width, height)
readonly property string borderEdgePath: generateBorderEdgePath(width, height)
MouseArea {
anchors.fill: parent
@@ -93,16 +93,16 @@ Item {
}
}
function generatePathForPosition() {
function generatePathForPosition(w, h) {
if (isTop)
return generateTopPath();
return generateTopPath(w, h);
if (isBottom)
return generateBottomPath();
return generateBottomPath(w, h);
if (isLeft)
return generateLeftPath();
return generateLeftPath(w, h);
if (isRight)
return generateRightPath();
return generateTopPath();
return generateRightPath(w, h);
return generateTopPath(w, h);
}
function generateBorderPathForPosition() {
@@ -117,9 +117,8 @@ Item {
return generateTopBorderPath();
}
function generateTopPath() {
const w = width;
const h = height - wing;
function generateTopPath(w, h) {
h = h - wing;
const r = wing;
const cr = rt;
@@ -147,16 +146,16 @@ Item {
return d;
}
function generateBottomPath() {
const w = width;
const h = height - wing;
function generateBottomPath(w, h) {
const fullH = h;
h = h - wing;
const r = wing;
const cr = rt;
let d = `M ${cr} ${height}`;
d += ` L ${w - cr} ${height}`;
let d = `M ${cr} ${fullH}`;
d += ` L ${w - cr} ${fullH}`;
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 0 ${w} ${height - cr}`;
d += ` A ${cr} ${cr} 0 0 0 ${w} ${fullH - cr}`;
if (r > 0) {
d += ` L ${w} 0`;
d += ` A ${r} ${r} 0 0 1 ${w - r} ${r}`;
@@ -170,16 +169,15 @@ Item {
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 0 0 ${cr}`;
}
d += ` L 0 ${height - cr}`;
d += ` L 0 ${fullH - cr}`;
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 0 ${cr} ${height}`;
d += ` A ${cr} ${cr} 0 0 0 ${cr} ${fullH}`;
d += " Z";
return d;
}
function generateLeftPath() {
const w = width - wing;
const h = height;
function generateLeftPath(w, h) {
w = w - wing;
const r = wing;
const cr = rt;
@@ -207,16 +205,16 @@ Item {
return d;
}
function generateRightPath() {
const w = width - wing;
const h = height;
function generateRightPath(w, h) {
const fullW = w;
w = w - wing;
const r = wing;
const cr = rt;
let d = `M ${width} ${cr}`;
d += ` L ${width} ${h - cr}`;
let d = `M ${fullW} ${cr}`;
d += ` L ${fullW} ${h - cr}`;
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 1 ${width - cr} ${h}`;
d += ` A ${cr} ${cr} 0 0 1 ${fullW - cr} ${h}`;
if (r > 0) {
d += ` L 0 ${h}`;
d += ` A ${r} ${r} 0 0 0 ${r} ${h - r}`;
@@ -230,9 +228,9 @@ Item {
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 1 ${cr} 0`;
}
d += ` L ${width - cr} 0`;
d += ` L ${fullW - cr} 0`;
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 1 ${width} ${cr}`;
d += ` A ${cr} ${cr} 0 0 1 ${fullW} ${cr}`;
d += " Z";
return d;
}
@@ -327,24 +325,24 @@ Item {
return d;
}
function generateBorderFullPath() {
function generateBorderFullPath(fullW, fullH) {
const i = barBorder.inset;
const r = wing;
const cr = rt;
if (isTop) {
const w = width - i * 2;
const h = height - wing - i * 2;
const w = fullW - i * 2;
const h = fullH - wing - i * 2;
let d = `M ${i + cr} ${i}`;
d += ` L ${i + w - cr} ${i}`;
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 1 ${i + w} ${i + cr}`;
if (r > 0) {
d += ` L ${i + w} ${height - i}`;
d += ` L ${i + w} ${fullH - i}`;
d += ` A ${r} ${r} 0 0 0 ${i + w - r} ${i + h}`;
d += ` L ${i + r} ${i + h}`;
d += ` A ${r} ${r} 0 0 0 ${i} ${height - i}`;
d += ` A ${r} ${r} 0 0 0 ${i} ${fullH - i}`;
} else {
d += ` L ${i + w} ${i + h - cr}`;
if (cr > 0)
@@ -361,13 +359,13 @@ Item {
}
if (isBottom) {
const w = width - i * 2;
const h = height - wing - i * 2;
const w = fullW - i * 2;
const h = fullH - wing - i * 2;
let d = `M ${i + cr} ${height - i}`;
d += ` L ${i + w - cr} ${height - i}`;
let d = `M ${i + cr} ${fullH - i}`;
d += ` L ${i + w - cr} ${fullH - i}`;
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 0 ${i + w} ${height - i - cr}`;
d += ` A ${cr} ${cr} 0 0 0 ${i + w} ${fullH - i - cr}`;
if (r > 0) {
d += ` L ${i + w} ${i}`;
d += ` A ${r} ${r} 0 0 1 ${i + w - r} ${i + r}`;
@@ -381,26 +379,26 @@ Item {
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 0 ${i} ${i + cr}`;
}
d += ` L ${i} ${height - i - cr}`;
d += ` L ${i} ${fullH - i - cr}`;
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 0 ${i + cr} ${height - i}`;
d += ` A ${cr} ${cr} 0 0 0 ${i + cr} ${fullH - i}`;
d += " Z";
return d;
}
if (isLeft) {
const w = width - wing - i * 2;
const h = height - i * 2;
const w = fullW - wing - i * 2;
const h = fullH - i * 2;
let d = `M ${i} ${i + cr}`;
d += ` L ${i} ${i + h - cr}`;
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 0 ${i + cr} ${i + h}`;
if (r > 0) {
d += ` L ${width - i} ${i + h}`;
d += ` L ${fullW - i} ${i + h}`;
d += ` A ${r} ${r} 0 0 1 ${i + w} ${i + h - r}`;
d += ` L ${i + w} ${i + r}`;
d += ` A ${r} ${r} 0 0 1 ${width - i} ${i}`;
d += ` A ${r} ${r} 0 0 1 ${fullW - i} ${i}`;
} else {
d += ` L ${i + w - cr} ${i + h}`;
if (cr > 0)
@@ -417,13 +415,13 @@ Item {
}
if (isRight) {
const w = width - wing - i * 2;
const h = height - i * 2;
const w = fullW - wing - i * 2;
const h = fullH - i * 2;
let d = `M ${width - i} ${i + cr}`;
d += ` L ${width - i} ${i + h - cr}`;
let d = `M ${fullW - i} ${i + cr}`;
d += ` L ${fullW - i} ${i + h - cr}`;
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 1 ${width - i - cr} ${i + h}`;
d += ` A ${cr} ${cr} 0 0 1 ${fullW - i - cr} ${i + h}`;
if (r > 0) {
d += ` L ${i} ${i + h}`;
d += ` A ${r} ${r} 0 0 0 ${i + r} ${i + h - r}`;
@@ -437,9 +435,9 @@ Item {
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 1 ${wing + i + cr} ${i}`;
}
d += ` L ${width - i - cr} ${i}`;
d += ` L ${fullW - i - cr} ${i}`;
if (cr > 0)
d += ` A ${cr} ${cr} 0 0 1 ${width - i} ${i + cr}`;
d += ` A ${cr} ${cr} 0 0 1 ${fullW - i} ${i + cr}`;
d += " Z";
return d;
}
@@ -447,14 +445,14 @@ Item {
return "";
}
function generateBorderEdgePath() {
function generateBorderEdgePath(fullW, fullH) {
const i = barBorder.inset;
const r = wing;
const cr = rt;
if (isTop) {
const w = width - i * 2;
const h = height - wing - i * 2;
const w = fullW - i * 2;
const h = fullH - wing - i * 2;
let d = "";
if (r > 0) {
@@ -474,7 +472,7 @@ Item {
}
if (isBottom) {
const w = width - i * 2;
const w = fullW - i * 2;
let d = "";
if (r > 0) {
@@ -494,8 +492,8 @@ Item {
}
if (isLeft) {
const w = width - wing - i * 2;
const h = height - i * 2;
const w = fullW - wing - i * 2;
const h = fullH - i * 2;
let d = "";
if (r > 0) {
@@ -515,7 +513,7 @@ Item {
}
if (isRight) {
const h = height - i * 2;
const h = fullH - i * 2;
let d = "";
if (r > 0) {