Skip to content

Build V2Ray rules dat files #272

Build V2Ray rules dat files

Build V2Ray rules dat files #272

Workflow file for this run

name: Build V2Ray rules dat files
on:
workflow_dispatch:
schedule:
- cron: "0 22 * * *"
push:
branches:
- master
paths-ignore:
- "**/README.md"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set variables
run: |
echo "RELEASE_NAME=Released on $(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "TAG_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
shell: bash
- name: Get geoip.dat relative files
run: |
wget https://raw.githubusercontent.com/lhear/geoip/release/geoip.dat
- name: Get geosite.dat relative files
run: |
wget https://raw.githubusercontent.com/lhear/geosite/release/geosite.dat
- name: Move and zip files and generate sha256 hash
run: |
install -Dp ./geoip.dat ./publish/geoip.dat
install -Dp ./geosite.dat ./publish/geosite.dat
cd ./publish || exit 1
zip rules.zip geoip.dat geosite.dat
sha256sum geoip.dat > geoip.dat.sha256sum
sha256sum geosite.dat > geosite.dat.sha256sum
sha256sum rules.zip > rules.zip.sha256sum
- name: Release and upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: ${{ env.RELEASE_NAME }}
tag: ${{ env.TAG_NAME }}
file_glob: true
file: ./publish/*
- name: Git push assets to "release" branch
run: |
cd publish || exit 1
git init
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b release
git add .
git commit -m "${{ env.RELEASE_NAME }}"
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git push -f -u origin release