Skip to content

Commit

Permalink
Use Go module
Browse files Browse the repository at this point in the history
  • Loading branch information
Loyalsoldier committed Oct 19, 2020
1 parent c4ce6fe commit 930a23a
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

0 comments on commit 930a23a

Please sign in to comment.