1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02: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 runs-on: ubuntu-latest
needs: build-core needs: build-core
steps: 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 - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
token: ${{ secrets.GH_PAT }} token: ${{ steps.app_token.outputs.token }}
fetch-depth: 0 fetch-depth: 0
- name: Update VERSION - name: Update VERSION
env: env:
GH_PAT: ${{ secrets.GH_PAT }} GH_TOKEN: ${{ steps.app_token.outputs.token }}
run: | run: |
set -euo pipefail set -euo pipefail
git config user.name "dms-ci" git config user.name "dms-ci[bot]"
git config user.email "dms-ci@users.noreply.github.com" git config user.email "dms-ci[bot]@users.noreply.github.com"
version="${GITHUB_REF#refs/tags/}" version="${GITHUB_REF#refs/tags/}"
echo "Updating to version: $version" echo "Updating to version: $version"
@@ -153,11 +160,12 @@ jobs:
if ! git diff --cached --quiet; then if ! git diff --cached --quiet; then
git commit -m "chore: bump version to $version" 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 fi
git tag -f "${version}" 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: release:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04

View File

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

View File

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