forked from v2fly/geoip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4ce6fe
commit 930a23a
Showing
1 changed file
with
17 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,17 +16,17 @@ jobs: | |
- name: Set up Go 1.x.y | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "^1.14.4" | ||
go-version: "^1.15.3" | ||
|
||
- name: Set $GOPATH and release variables | ||
- name: Set variables | ||
run: | | ||
echo "TAG_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV | ||
echo "RELEASE_NAME=$(date +%Y%m%d%H%M)" >> $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: Checkout codebase | ||
uses: actions/[email protected] | ||
|
||
- name: Get GeoLite2 | ||
env: | ||
LICENSE_KEY: ${{ secrets.MAXMIND_LICEHSE }} | ||
|
@@ -38,22 +38,28 @@ jobs: | |
- name: Build geoip.dat | ||
run: | | ||
go get -v -insecure $REPO_URL | ||
geoip --country=./geoip/GeoLite2-Country-Locations-en.csv --ipv4=./geoip/GeoLite2-Country-Blocks-IPv4.csv --ipv6=./geoip/GeoLite2-Country-Blocks-IPv6.csv | ||
go mod download | ||
go run ./ --country=./geoip/GeoLite2-Country-Locations-en.csv --ipv4=./geoip/GeoLite2-Country-Blocks-IPv4.csv --ipv6=./geoip/GeoLite2-Country-Blocks-IPv6.csv | ||
- name: Generate geoip.dat sha256 checksum | ||
run: sha256sum geoip.dat > geoip.dat.sha256sum | ||
|
||
- name: Move files to publish directory | ||
run: | | ||
mkdir -p publish | ||
mv geoip.dat geoip.dat.sha256sum ./publish | ||
- name: Git push assets to "release" branch | ||
run: | | ||
cd publish | ||
git init | ||
git config --local user.name "actions" | ||
git config --local user.email "[email protected]" | ||
git checkout -b release | ||
git add geoip.dat geoip.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 | ||
git remote add geoip "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" | ||
git push -f geoip release | ||
- name: Create a release | ||
id: create_release | ||
|
@@ -72,7 +78,7 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./geoip.dat | ||
asset_path: ./publish/geoip.dat | ||
asset_name: geoip.dat | ||
asset_content_type: application/octet-stream | ||
|
||
|
@@ -82,6 +88,6 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./geoip.dat.sha256sum | ||
asset_path: ./publish/geoip.dat.sha256sum | ||
asset_name: geoip.dat.sha256sum | ||
asset_content_type: text/plain |