mirror of
https://github.com/v2fly/domain-list-community.git
synced 2024-11-16 17:14:52 +02:00
82 lines
2.5 KiB
YAML
82 lines
2.5 KiB
YAML
name: Build dlc.dat
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- "**/README.md"
|
|
- ".github/**"
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Setup Go 1.14
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.14
|
|
|
|
- name: Set $GOPATH and more variables
|
|
run: |
|
|
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)"
|
|
echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin"
|
|
shell: bash
|
|
|
|
- name: Go get project code
|
|
run: |
|
|
go get -u -v -insecure $REPO_URL
|
|
|
|
- name: Build dlc.dat file
|
|
run: |
|
|
domain-list-community --datapath=${{ env.GOPATH }}/src/${{ env.REPO_URL }}/data
|
|
|
|
- name: Generate dlc.dat sha256 hash
|
|
run: |
|
|
sha256sum dlc.dat > dlc.dat.sha256sum
|
|
|
|
- name: Git push assets to "release" branch
|
|
run: |
|
|
git init
|
|
git config --local user.name "${{ github.actor }}"
|
|
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
|
|
git checkout -b release
|
|
git add dlc.dat dlc.dat.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
|