mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-09-27 03:31:48 +02:00
chore: discord server notifications
This commit is contained in:
+106
-83
@@ -237,93 +237,116 @@ jobs:
|
|||||||
# branch: main
|
# branch: main
|
||||||
# commit_message: "docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]"
|
# commit_message: "docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]"
|
||||||
|
|
||||||
publish-repos:
|
# publish-repos:
|
||||||
|
# if: github.repository == 'zhom/donutbrowser'
|
||||||
|
# needs: [release]
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# permissions:
|
||||||
|
# contents: read
|
||||||
|
# steps:
|
||||||
|
# - name: Download Linux packages from release
|
||||||
|
# env:
|
||||||
|
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# run: |
|
||||||
|
# mkdir -p /tmp/packages
|
||||||
|
# gh release download "$GITHUB_REF_NAME" \
|
||||||
|
# --repo "$GITHUB_REPOSITORY" \
|
||||||
|
# --pattern "*.deb" \
|
||||||
|
# --dir /tmp/packages
|
||||||
|
# gh release download "$GITHUB_REF_NAME" \
|
||||||
|
# --repo "$GITHUB_REPOSITORY" \
|
||||||
|
# --pattern "*.rpm" \
|
||||||
|
# --dir /tmp/packages
|
||||||
|
# echo "Downloaded packages:"
|
||||||
|
# ls -la /tmp/packages/
|
||||||
|
#
|
||||||
|
# - name: Setup Go
|
||||||
|
# uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0
|
||||||
|
# with:
|
||||||
|
# go-version: "1.23"
|
||||||
|
# cache: false
|
||||||
|
#
|
||||||
|
# - name: Install repogen
|
||||||
|
# run: |
|
||||||
|
# go install github.com/ralt/repogen/cmd/repogen@latest
|
||||||
|
# echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
|
||||||
|
#
|
||||||
|
# - name: Sync existing repo metadata from R2
|
||||||
|
# env:
|
||||||
|
# AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||||
|
# AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||||
|
# AWS_DEFAULT_REGION: auto
|
||||||
|
# R2_ENDPOINT: "https://${{ secrets.R2_ENDPOINT_URL }}"
|
||||||
|
# R2_BUCKET: ${{ secrets.R2_BUCKET_NAME }}
|
||||||
|
# run: |
|
||||||
|
# mkdir -p /tmp/repo
|
||||||
|
# aws s3 cp "s3://${R2_BUCKET}/dists" /tmp/repo/dists \
|
||||||
|
# --endpoint-url "${R2_ENDPOINT}" --recursive 2>/dev/null || true
|
||||||
|
# aws s3 cp "s3://${R2_BUCKET}/repodata" /tmp/repo/repodata \
|
||||||
|
# --endpoint-url "${R2_ENDPOINT}" --recursive 2>/dev/null || true
|
||||||
|
#
|
||||||
|
# - name: Generate repository with repogen
|
||||||
|
# run: |
|
||||||
|
# repogen generate \
|
||||||
|
# --input-dir /tmp/packages \
|
||||||
|
# --output-dir /tmp/repo \
|
||||||
|
# --incremental \
|
||||||
|
# --arch amd64,arm64 \
|
||||||
|
# --origin "Donut Browser" \
|
||||||
|
# --label "Donut Browser" \
|
||||||
|
# --codename stable \
|
||||||
|
# --components main \
|
||||||
|
# --verbose
|
||||||
|
#
|
||||||
|
# - name: Upload repository to R2
|
||||||
|
# env:
|
||||||
|
# AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||||
|
# AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||||
|
# AWS_DEFAULT_REGION: auto
|
||||||
|
# R2_ENDPOINT: "https://${{ secrets.R2_ENDPOINT_URL }}"
|
||||||
|
# R2_BUCKET: ${{ secrets.R2_BUCKET_NAME }}
|
||||||
|
# run: |
|
||||||
|
# aws s3 cp /tmp/repo/dists "s3://${R2_BUCKET}/dists" \
|
||||||
|
# --endpoint-url "${R2_ENDPOINT}" --recursive
|
||||||
|
# aws s3 cp /tmp/repo/pool "s3://${R2_BUCKET}/pool" \
|
||||||
|
# --endpoint-url "${R2_ENDPOINT}" --recursive
|
||||||
|
# aws s3 cp /tmp/repo/repodata "s3://${R2_BUCKET}/repodata" \
|
||||||
|
# --endpoint-url "${R2_ENDPOINT}" --recursive
|
||||||
|
# aws s3 cp /tmp/repo/Packages "s3://${R2_BUCKET}/Packages" \
|
||||||
|
# --endpoint-url "${R2_ENDPOINT}" --recursive
|
||||||
|
#
|
||||||
|
# - name: Verify upload
|
||||||
|
# env:
|
||||||
|
# AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||||
|
# AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||||
|
# AWS_DEFAULT_REGION: auto
|
||||||
|
# R2_ENDPOINT: "https://${{ secrets.R2_ENDPOINT_URL }}"
|
||||||
|
# R2_BUCKET: ${{ secrets.R2_BUCKET_NAME }}
|
||||||
|
# run: |
|
||||||
|
# echo "DEB repo:"
|
||||||
|
# aws s3 ls "s3://${R2_BUCKET}/dists/stable/" --endpoint-url "${R2_ENDPOINT}" || echo " (listing not available)"
|
||||||
|
# echo "RPM repo:"
|
||||||
|
# aws s3 ls "s3://${R2_BUCKET}/repodata/" --endpoint-url "${R2_ENDPOINT}" || echo " (listing not available)"
|
||||||
|
|
||||||
|
notify-discord:
|
||||||
if: github.repository == 'zhom/donutbrowser'
|
if: github.repository == 'zhom/donutbrowser'
|
||||||
needs: [release]
|
needs: [release]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download Linux packages from release
|
- name: Send Discord notification
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_STABLE_WEBHOOK_URL }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/packages
|
VERSION="${GITHUB_REF_NAME}"
|
||||||
gh release download "$GITHUB_REF_NAME" \
|
RELEASE_URL="https://github.com/${GITHUB_REPOSITORY}/releases/tag/${VERSION}"
|
||||||
--repo "$GITHUB_REPOSITORY" \
|
|
||||||
--pattern "*.deb" \
|
|
||||||
--dir /tmp/packages
|
|
||||||
gh release download "$GITHUB_REF_NAME" \
|
|
||||||
--repo "$GITHUB_REPOSITORY" \
|
|
||||||
--pattern "*.rpm" \
|
|
||||||
--dir /tmp/packages
|
|
||||||
echo "Downloaded packages:"
|
|
||||||
ls -la /tmp/packages/
|
|
||||||
|
|
||||||
- name: Setup Go
|
curl -fsSL -H "Content-Type: application/json" \
|
||||||
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0
|
-d "{
|
||||||
with:
|
\"embeds\": [{
|
||||||
go-version: "1.23"
|
\"title\": \"Donut Browser ${VERSION} Released\",
|
||||||
cache: false
|
\"url\": \"${RELEASE_URL}\",
|
||||||
|
\"description\": \"A new stable release of Donut Browser is available.\",
|
||||||
- name: Install repogen
|
\"color\": 5814783
|
||||||
run: |
|
}]
|
||||||
go install github.com/ralt/repogen/cmd/repogen@latest
|
}" \
|
||||||
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
|
"$DISCORD_WEBHOOK_URL"
|
||||||
|
|
||||||
- name: Sync existing repo metadata from R2
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: auto
|
|
||||||
R2_ENDPOINT: "https://${{ secrets.R2_ENDPOINT_URL }}"
|
|
||||||
R2_BUCKET: ${{ secrets.R2_BUCKET_NAME }}
|
|
||||||
run: |
|
|
||||||
mkdir -p /tmp/repo
|
|
||||||
aws s3 cp "s3://${R2_BUCKET}/dists" /tmp/repo/dists \
|
|
||||||
--endpoint-url "${R2_ENDPOINT}" --recursive 2>/dev/null || true
|
|
||||||
aws s3 cp "s3://${R2_BUCKET}/repodata" /tmp/repo/repodata \
|
|
||||||
--endpoint-url "${R2_ENDPOINT}" --recursive 2>/dev/null || true
|
|
||||||
|
|
||||||
- name: Generate repository with repogen
|
|
||||||
run: |
|
|
||||||
repogen generate \
|
|
||||||
--input-dir /tmp/packages \
|
|
||||||
--output-dir /tmp/repo \
|
|
||||||
--incremental \
|
|
||||||
--arch amd64,arm64 \
|
|
||||||
--origin "Donut Browser" \
|
|
||||||
--label "Donut Browser" \
|
|
||||||
--codename stable \
|
|
||||||
--components main \
|
|
||||||
--verbose
|
|
||||||
|
|
||||||
- name: Upload repository to R2
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: auto
|
|
||||||
R2_ENDPOINT: "https://${{ secrets.R2_ENDPOINT_URL }}"
|
|
||||||
R2_BUCKET: ${{ secrets.R2_BUCKET_NAME }}
|
|
||||||
run: |
|
|
||||||
aws s3 cp /tmp/repo/dists "s3://${R2_BUCKET}/dists" \
|
|
||||||
--endpoint-url "${R2_ENDPOINT}" --recursive
|
|
||||||
aws s3 cp /tmp/repo/pool "s3://${R2_BUCKET}/pool" \
|
|
||||||
--endpoint-url "${R2_ENDPOINT}" --recursive
|
|
||||||
aws s3 cp /tmp/repo/repodata "s3://${R2_BUCKET}/repodata" \
|
|
||||||
--endpoint-url "${R2_ENDPOINT}" --recursive
|
|
||||||
aws s3 cp /tmp/repo/Packages "s3://${R2_BUCKET}/Packages" \
|
|
||||||
--endpoint-url "${R2_ENDPOINT}" --recursive
|
|
||||||
|
|
||||||
- name: Verify upload
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: auto
|
|
||||||
R2_ENDPOINT: "https://${{ secrets.R2_ENDPOINT_URL }}"
|
|
||||||
R2_BUCKET: ${{ secrets.R2_BUCKET_NAME }}
|
|
||||||
run: |
|
|
||||||
echo "DEB repo:"
|
|
||||||
aws s3 ls "s3://${R2_BUCKET}/dists/stable/" --endpoint-url "${R2_ENDPOINT}" || echo " (listing not available)"
|
|
||||||
echo "RPM repo:"
|
|
||||||
aws s3 ls "s3://${R2_BUCKET}/repodata/" --endpoint-url "${R2_ENDPOINT}" || echo " (listing not available)"
|
|
||||||
|
|||||||
@@ -293,3 +293,26 @@ jobs:
|
|||||||
--title "Donut Browser Nightly" \
|
--title "Donut Browser Nightly" \
|
||||||
--notes "Automatically updated nightly build from the latest main branch.\n\nCommit: ${GITHUB_SHA}" \
|
--notes "Automatically updated nightly build from the latest main branch.\n\nCommit: ${GITHUB_SHA}" \
|
||||||
--prerelease
|
--prerelease
|
||||||
|
|
||||||
|
notify-discord:
|
||||||
|
if: github.repository == 'zhom/donutbrowser'
|
||||||
|
needs: [update-nightly-release]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Send Discord notification
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_NIGHTLY_WEBHOOK_URL }}
|
||||||
|
run: |
|
||||||
|
COMMIT_SHORT=$(echo "${GITHUB_SHA}" | cut -c1-7)
|
||||||
|
RELEASE_URL="https://github.com/${GITHUB_REPOSITORY}/releases/tag/nightly"
|
||||||
|
|
||||||
|
curl -fsSL -H "Content-Type: application/json" \
|
||||||
|
-d "{
|
||||||
|
\"embeds\": [{
|
||||||
|
\"title\": \"Donut Browser Nightly Updated\",
|
||||||
|
\"url\": \"${RELEASE_URL}\",
|
||||||
|
\"description\": \"A new nightly build is available (${COMMIT_SHORT}).\",
|
||||||
|
\"color\": 16752128
|
||||||
|
}]
|
||||||
|
}" \
|
||||||
|
"$DISCORD_WEBHOOK_URL"
|
||||||
|
|||||||
Reference in New Issue
Block a user