v2fly-domain-list-community/.github/workflows/build.yml

81 lines
2.6 KiB
YAML
Raw Normal View History

name: Build dlc.dat
2020-01-05 03:28:32 +02:00
on:
push:
branches:
- master
2020-06-02 23:09:42 +03:00
paths-ignore:
- "**/README.md"
2020-01-05 03:28:32 +02:00
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
2020-07-12 05:59:41 +03:00
- name: Setup Go 1.x.y
2020-06-06 05:40:14 +03:00
uses: actions/setup-go@v2
2020-01-05 03:28:32 +02:00
with:
go-version: "^1.14.4"
2020-01-05 03:28:32 +02:00
- name: Set $GOPATH and more variables
run: |
2020-07-06 05:00:19 +03:00
echo "::set-env name=RELEASE_NAME::$(date +%Y%m%d%H%M%S)"
echo "::set-env name=TAG_NAME::$(date +%Y%m%d%H%M%S)"
echo "::set-env name=REPO_URL::github.com/${{ github.repository }}"
echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)"
2020-01-05 03:28:32 +02:00
echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin"
shell: bash
- name: Go get project code
2020-01-05 03:28:32 +02:00
run: |
go get -v -insecure $REPO_URL
2020-01-05 03:28:32 +02:00
- name: Build dlc.dat file
2020-01-05 03:28:32 +02:00
run: |
2020-07-31 03:36:00 +03:00
domain-list-community --datapath=${{ env.GOPATH }}/src/${{ env.REPO_URL }}/data --exportlists=category-ads-all,tld-cn,cn,tld-\!cn,geolocation-\!cn,apple,icloud
2020-01-05 03:28:32 +02:00
2020-03-12 17:00:07 +02:00
- name: Generate dlc.dat sha256 hash
run: |
sha256sum dlc.dat > dlc.dat.sha256sum
- name: Git push assets to "release" branch
run: |
git init
2020-07-12 05:59:41 +03:00
git config --local user.name "actions"
git config --local user.email "action@github.com"
git checkout -b release
git add dlc.dat dlc.dat.sha256sum *.txt
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
2020-03-12 17:00:07 +02:00
- name: Upload dlc.dat
uses: actions/upload-release-asset@v1
2020-01-05 03:28:32 +02:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2020-02-27 12:47:38 +02:00
asset_path: ./dlc.dat
asset_name: dlc.dat
asset_content_type: application/octet-stream
2020-03-12 17:00:07 +02:00
- 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