initial commit
This commit is contained in:
30
examples/danklinux/.github/workflows/pr.yml
vendored
Normal file
30
examples/danklinux/.github/workflows/pr.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Format check
|
||||
run: |
|
||||
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
|
||||
echo "The following files are not formatted:"
|
||||
gofmt -s -l .
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Test
|
||||
run: go test -v ./...
|
||||
|
||||
- name: Build
|
||||
run: go build -v ./...
|
||||
169
examples/danklinux/.github/workflows/release.yml
vendored
Normal file
169
examples/danklinux/.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: release-${{ github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [amd64, arm64]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: ./go.mod
|
||||
|
||||
- name: Run tests
|
||||
run: go test -v ./...
|
||||
|
||||
- name: Build dankinstall (${{ matrix.arch }})
|
||||
env:
|
||||
GOOS: linux
|
||||
CGO_ENABLED: 0
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
run: |
|
||||
set -eux
|
||||
cd cmd/dankinstall
|
||||
go build -trimpath -ldflags "-s -w -X main.Version=${GITHUB_REF#refs/tags/}" \
|
||||
-o ../../dankinstall-${{ matrix.arch }}
|
||||
cd ../..
|
||||
gzip -9 -k dankinstall-${{ matrix.arch }}
|
||||
sha256sum dankinstall-${{ matrix.arch }}.gz > dankinstall-${{ matrix.arch }}.gz.sha256
|
||||
|
||||
- name: Build dms (${{ matrix.arch }})
|
||||
env:
|
||||
GOOS: linux
|
||||
CGO_ENABLED: 0
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
run: |
|
||||
set -eux
|
||||
cd cmd/dms
|
||||
go build -trimpath -ldflags "-s -w -X main.Version=${GITHUB_REF#refs/tags/}" \
|
||||
-o ../../dms-${{ matrix.arch }}
|
||||
cd ../..
|
||||
gzip -9 -k dms-${{ matrix.arch }}
|
||||
sha256sum dms-${{ matrix.arch }}.gz > dms-${{ matrix.arch }}.gz.sha256
|
||||
|
||||
- name: Build dms-distropkg (${{ matrix.arch }})
|
||||
env:
|
||||
GOOS: linux
|
||||
CGO_ENABLED: 0
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
run: |
|
||||
set -eux
|
||||
cd cmd/dms
|
||||
go build -trimpath -tags distro_binary -ldflags "-s -w -X main.Version=${GITHUB_REF#refs/tags/}" \
|
||||
-o ../../dms-distropkg-${{ matrix.arch }}
|
||||
cd ../..
|
||||
gzip -9 -k dms-distropkg-${{ matrix.arch }}
|
||||
sha256sum dms-distropkg-${{ matrix.arch }}.gz > dms-distropkg-${{ matrix.arch }}.gz.sha256
|
||||
|
||||
- name: Upload artifacts (${{ matrix.arch }})
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-assets-${{ matrix.arch }}
|
||||
path: |
|
||||
dankinstall-${{ matrix.arch }}.gz
|
||||
dankinstall-${{ matrix.arch }}.gz.sha256
|
||||
dms-${{ matrix.arch }}.gz
|
||||
dms-${{ matrix.arch }}.gz.sha256
|
||||
dms-distropkg-${{ matrix.arch }}.gz
|
||||
dms-distropkg-${{ matrix.arch }}.gz.sha256
|
||||
if-no-files-found: error
|
||||
|
||||
update-flake-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Update flake.nix version
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
version="${GITHUB_REF#refs/tags/}"
|
||||
version="${version#v}"
|
||||
echo "Updating flake.nix to version: $version"
|
||||
|
||||
# Update version in flake.nix
|
||||
sed -i "s/version = \"[^\"]*\"/version = \"$version\"/" flake.nix
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
if ! git diff --quiet flake.nix; then
|
||||
git add flake.nix
|
||||
git commit -m "flake: bump version to $version"
|
||||
|
||||
# Push to master (or main, depending on your default branch)
|
||||
git push origin HEAD:master || git push origin HEAD:main
|
||||
echo "Pushed flake.nix version update to master"
|
||||
else
|
||||
echo "No version changes needed"
|
||||
fi
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: release-assets-*
|
||||
merge-multiple: true
|
||||
path: ./_dist
|
||||
|
||||
- name: Create/Update GitHub Release (single run)
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: Release ${{ github.ref_name }}
|
||||
body: |
|
||||
## Danklinux Release
|
||||
|
||||
This release includes binaries for:
|
||||
- Linux AMD64
|
||||
- Linux ARM64
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
curl -fsSL https://raw.githubusercontent.com/AvengeMedia/danklinux/master/install.sh | sh
|
||||
```
|
||||
files: _dist/**
|
||||
draft: false
|
||||
prerelease: ${{ contains(github.ref_name, '-') }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Notify DankMaterialShell to create release and mirror assets (single run)
|
||||
uses: peter-evans/repository-dispatch@v3
|
||||
with:
|
||||
token: ${{ secrets.SHELL_REPO_PAT }}
|
||||
repository: AvengeMedia/DankMaterialShell
|
||||
event-type: dms_release
|
||||
client-payload: >-
|
||||
{
|
||||
"tag": "${{ github.ref_name }}",
|
||||
"dms_repo": "${{ github.repository }}"
|
||||
}
|
||||
89
examples/danklinux/.github/workflows/update-vendor-hash.yml
vendored
Normal file
89
examples/danklinux/.github/workflows/update-vendor-hash.yml
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
name: Update Vendor Hash
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "go.mod"
|
||||
- "go.sum"
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
update-vendor-hash:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v31
|
||||
|
||||
- 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 .#dms-cli 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
|
||||
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
|
||||
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 .#dms-cli
|
||||
|
||||
echo "vendorHash updated successfully!"
|
||||
|
||||
- name: Commit and push vendorHash update
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if ! git diff --quiet flake.nix; then
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git add flake.nix
|
||||
git commit -m "flake: update vendorHash for go.mod changes"
|
||||
|
||||
for attempt in 1 2 3; do
|
||||
if git push; then
|
||||
echo "Successfully pushed vendorHash update"
|
||||
exit 0
|
||||
fi
|
||||
echo "Push attempt $attempt failed, pulling and retrying..."
|
||||
git pull --rebase
|
||||
sleep $((attempt*2))
|
||||
done
|
||||
|
||||
echo "Failed to push after retries" >&2
|
||||
exit 1
|
||||
else
|
||||
echo "No changes to flake.nix"
|
||||
fi
|
||||
Reference in New Issue
Block a user