Skip to content

Synchronization GEO Asset #384

Synchronization GEO Asset

Synchronization GEO Asset #384

Workflow file for this run

name: Synchronization GEO Asset
on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- "**/README.md"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get latest go version
id: version
run: |
echo ::set-output name=go_version::$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g')
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.version.outputs.go_version }}
- name: Build geosite
id: build_site
run: |
cd sing-geosite
go run -v .
sha256sum geosite.db > geosite.db.sha256sum
- name: Build geoip
id: build_ip
run: |
cd sing-geoip
go run -v .
sha256sum geoip.db > geoip.db.sha256sum
- name: Release rule sets geosite
run: |
chmod +x .github/release-rule-set-geosite.sh
bash .github/release-rule-set-geosite.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release rule sets geoip
run: |
chmod +x .github/release-rule-set-geoip.sh
bash .github/release-rule-set-geoip.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set timezone to WIB Jakarta
uses: szenius/set-timezone@v1.2
with:
timezoneLinux: "Asia/Jakarta"
timezoneMacos: "Asia/Jakarta"
timezoneWindows: "Indonesia Standard Time"
- name: Get current time
id: time
run: echo "::set-output name=time::$(date +'%Y%m%d%H%M%S')"
- name: Create a release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.time.outputs.time }}
release_name: ${{ steps.time.outputs.time }}
draft: false
prerelease: false
- name: Release geosite.db
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sing-geosite/geosite.db
asset_name: geosite.db
asset_content_type: application/octet-stream
- name: Release geosite.db.sha256sum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sing-geosite/geosite.db.sha256sum
asset_name: geosite.db.sha256sum
asset_content_type: application/octet-stream
- name: Release geoip.db
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sing-geoip/geoip.db
asset_name: geoip.db
asset_content_type: application/octet-stream
- name: Release geoip.db.sha256sum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sing-geoip/geoip.db.sha256sum
asset_name: geoip.db.sha256sum
asset_content_type: application/octet-stream
- name: Delete Old Release
uses: dev-drprasad/delete-older-releases@v0.2.1
with:
repo: malikshi/sing-box-geo
keep_latest: 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Purge rule-set-geosite jsdelivr CDN
run: |
cd sing-geosite/rule-set-geosite || exit 1
for file in $(ls); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@rule-set-geosite/${file}"
done
- name: Purge rule-set-geoip jsdelivr CDN
run: |
cd sing-geoip/rule-set-geoip || exit 1
for file in $(ls); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@rule-set-geoip/${file}"
done