155 lines
5.1 KiB
YAML
155 lines
5.1 KiB
YAML
name: Build dlc.dat
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- "**/README.md"
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Setup Go 1.x.y
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ^1.15
|
|
|
|
- name: Set $GOPATH and more variables
|
|
run: |
|
|
echo "RELEASE_NAME=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
|
|
echo "TAG_NAME=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
|
|
echo "REPO_URL=github.com/${{ github.repository }}" >> $GITHUB_ENV
|
|
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
|
|
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
|
|
shell: bash
|
|
|
|
- name: Go get project code
|
|
run: |
|
|
go get -v -insecure $REPO_URL
|
|
|
|
- name: Build dlc.dat file
|
|
run: |
|
|
domain-list-community --datapath=${{ env.GOPATH }}/src/${{ env.REPO_URL }}/data --exportlists=category-ads-all,tld-cn,cn,tld-\!cn,geolocation-\!cn,apple,icloud
|
|
|
|
- name: Generate dlc.dat sha256 hash
|
|
run: |
|
|
sha256sum dlc.dat > dlc.dat.sha256sum
|
|
|
|
- name: Generate Zip
|
|
run: |
|
|
zip -9 dlc.dat.zip dlc.dat
|
|
sha256sum dlc.dat.zip > dlc.dat.zip.sha256sum
|
|
|
|
- name: Generate XZ
|
|
run: |
|
|
xz -z -9 -k dlc.dat
|
|
sha256sum dlc.dat.xz > dlc.dat.xz.sha256sum
|
|
|
|
- name: Generate gfwlist.txt sha256 hash
|
|
run: |
|
|
sha256sum gfwlist.txt > gfwlist.txt.sha256sum
|
|
|
|
- name: Git push assets to "release" branch
|
|
run: |
|
|
git init
|
|
git config --local user.name "actions"
|
|
git config --local user.email "action@github.com"
|
|
git checkout -b release
|
|
git add *.txt dlc.dat dlc.dat.sha256sum dlc.dat.zip dlc.dat.zip.sha256sum dlc.dat.xz dlc.dat.xz.sha256sum gfwlist.txt gfwlist.txt.sha256sum
|
|
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
|
|
|
|
- name: Create a release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ env.TAG_NAME }}
|
|
release_name: ${{ env.RELEASE_NAME }}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Upload dlc.dat
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./dlc.dat
|
|
asset_name: dlc.dat
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: Upload dlc.dat sha256sum
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./dlc.dat.sha256sum
|
|
asset_name: dlc.dat.sha256sum
|
|
asset_content_type: text/plain
|
|
|
|
- name: Upload dlc.dat.zip
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./dlc.dat.zip
|
|
asset_name: dlc.dat.zip
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: Upload dlc.dat.zip sha256sum
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./dlc.dat.zip.sha256sum
|
|
asset_name: dlc.dat.zip.sha256sum
|
|
asset_content_type: text/plain
|
|
|
|
- name: Upload dlc.dat.xz
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./dlc.dat.xz
|
|
asset_name: dlc.dat.xz
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: Upload dlc.dat.xz sha256sum
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./dlc.dat.xz.sha256sum
|
|
asset_name: dlc.dat.xz.sha256sum
|
|
asset_content_type: text/plain
|
|
|
|
- name: Upload gfwlist.txt
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./gfwlist.txt
|
|
asset_name: gfwlist.txt
|
|
asset_content_type: text/plain
|
|
|
|
- name: Upload gfwlist.txt sha256sum
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./gfwlist.txt.sha256sum
|
|
asset_name: gfwlist.txt.sha256sum
|
|
asset_content_type: text/plain
|