Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 79864ace88 |
1 changed files with 21 additions and 30 deletions
51
.github/workflows/build.yml
vendored
51
.github/workflows/build.yml
vendored
|
|
@ -12,23 +12,14 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# --------------------------------------------------
|
|
||||||
# Checkout
|
|
||||||
# --------------------------------------------------
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# Go setup
|
|
||||||
# --------------------------------------------------
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.22"
|
go-version: "1.22"
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# Build binaries
|
|
||||||
# --------------------------------------------------
|
|
||||||
- name: Build for ARMv6 (Pi Zero / Pi 1)
|
- name: Build for ARMv6 (Pi Zero / Pi 1)
|
||||||
run: |
|
run: |
|
||||||
GOOS=linux GOARCH=arm GOARM=6 \
|
GOOS=linux GOARCH=arm GOARM=6 \
|
||||||
|
|
@ -39,9 +30,6 @@ jobs:
|
||||||
GOOS=linux GOARCH=arm64 \
|
GOOS=linux GOARCH=arm64 \
|
||||||
go build -ldflags="-s -w" -o wol-server-arm64
|
go build -ldflags="-s -w" -o wol-server-arm64
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# systemd service (portable, no hardcoded user)
|
|
||||||
# --------------------------------------------------
|
|
||||||
- name: Create systemd service file
|
- name: Create systemd service file
|
||||||
run: |
|
run: |
|
||||||
cat > wol-server.service << 'EOF'
|
cat > wol-server.service << 'EOF'
|
||||||
|
|
@ -61,9 +49,6 @@ jobs:
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# Install script (auto-detect architecture)
|
|
||||||
# --------------------------------------------------
|
|
||||||
- name: Create install script
|
- name: Create install script
|
||||||
run: |
|
run: |
|
||||||
cat > install.sh << 'EOF'
|
cat > install.sh << 'EOF'
|
||||||
|
|
@ -118,9 +103,6 @@ jobs:
|
||||||
|
|
||||||
chmod +x install.sh
|
chmod +x install.sh
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# Package
|
|
||||||
# --------------------------------------------------
|
|
||||||
- name: Create release package
|
- name: Create release package
|
||||||
run: |
|
run: |
|
||||||
mkdir -p package
|
mkdir -p package
|
||||||
|
|
@ -132,16 +114,25 @@ jobs:
|
||||||
|
|
||||||
tar -czf wol-server.tar.gz -C package .
|
tar -czf wol-server.tar.gz -C package .
|
||||||
|
|
||||||
# --------------------------------------------------
|
- name: Create Forgejo Release
|
||||||
# GitHub Release
|
|
||||||
# --------------------------------------------------
|
|
||||||
- name: Create GitHub Release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
with:
|
run: |
|
||||||
tag_name: v${{ github.run_number }}
|
TAG="v${{ github.run_number }}"
|
||||||
name: Release v${{ github.run_number }}
|
API_URL="${{ github.server_url }}/api/v1"
|
||||||
files: |
|
REPO="${{ github.repository }}"
|
||||||
wol-server.tar.gz
|
|
||||||
env:
|
# Create release
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
RELEASE_ID=$(curl -s -X POST \
|
||||||
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${API_URL}/repos/${REPO}/releases" \
|
||||||
|
-d "{\"tag_name\": \"${TAG}\", \"name\": \"Release ${TAG}\", \"draft\": false, \"prerelease\": false}" \
|
||||||
|
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
|
|
||||||
|
# Upload asset
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
|
"${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=wol-server.tar.gz" \
|
||||||
|
-F "attachment=@wol-server.tar.gz" > /dev/null
|
||||||
|
|
||||||
|
echo "Release ${TAG} created with asset wol-server.tar.gz"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue