GitHub Actions: Upload to Releases

This commit is contained in:
P3TERX 2021-02-21 03:00:58 +08:00
parent 849a5100ff
commit 886436aac1
No known key found for this signature in database
GPG Key ID: F62C168888888888
2 changed files with 33 additions and 15 deletions

View File

@ -1,18 +1,20 @@
#=================================================
#
# Copyright (c) 2020-2021 P3TERX <https://p3terx.com>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/P3TERX/GeoLite.mmdb
# Description: Publish GeoLite.mmdb
# Lisence: MIT
# Author: P3TERX
# Blog: https://p3terx.com
#=================================================
#
name: Publish GeoLite.mmdb
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: 0 22 */3 * *
# watch:
# types: started
- cron: 0 1 */3 * *
jobs:
run:
@ -22,13 +24,12 @@ jobs:
steps:
- name: Download GeoLite.mmdb
run: |
wget -nv -O- "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${LICENSE_KEY}&suffix=tar.gz" | tar zxvC .
wget -nv -O- "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${LICENSE_KEY}&suffix=tar.gz" | tar zxvC .
wget -nv -O- "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${LICENSE_KEY}&suffix=tar.gz" | tar zxvC .
wget -nv -O- "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${{ secrets.LICENSE_KEY }}&suffix=tar.gz" | tar zxv
wget -nv -O- "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${{ secrets.LICENSE_KEY }}&suffix=tar.gz" | tar zxv
wget -nv -O- "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${{ secrets.LICENSE_KEY }}&suffix=tar.gz" | tar zxv
mkdir -p upload
cp -v GeoLite*/*.mmdb upload
env:
LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
echo "TAG_NAME=$(date +"%Y.%m.%d")" >> $GITHUB_ENV
- name: Push to "download" branch
run: |
@ -38,6 +39,23 @@ jobs:
git config user.email "${{ github.actor }}@users.noreply.github.com"
git checkout -b download
git add .
git commit -m "$(date +"%Y.%m.%d")"
git commit -m "${{ env.TAG_NAME }}"
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git push -f origin download
- name: Upload to Releases
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
body: ${{ env.TAG_NAME }}
files: upload/*.mmdb
- name: Remove old Releases
uses: dev-drprasad/delete-older-releases@v0.2.0
with:
keep_latest: 2
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 P3TERX
Copyright (c) 2020-2021 P3TERX
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal