Build geoip.dat #101
This file contains hidden or 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
| name: Build geoip.dat | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * 0" | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - "README.md" | |
| - ".gitignore" | |
| - "LICENSE" | |
| - "**/dependabot.yml" | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout codebase | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - 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 | |
| shell: bash | |
| - name: Build geoip.dat | |
| run: | | |
| go run ./ | |
| - name: Generate sha256 checksum for dat files | |
| run: | | |
| cd ./output/dat || exit 1 | |
| for name in $(ls *.dat); do | |
| sha256sum ${name} > ./${name}.sha256sum | |
| done | |
| - name: Move files to publish directory | |
| run: | | |
| mkdir -p publish | |
| mv ./output/dat/*.dat ./output/dat/*.sha256sum ./publish | |
| - name: Release and upload assets | |
| run: | | |
| gh release create ${{ env.TAG_NAME }} -t ${{ env.RELEASE_NAME }} \ | |
| ./publish/*.dat \ | |
| ./publish/*.dat.sha256sum | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} |