Release Workflow #154
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
# This workflow updates the database and creates a release of it everyday | |
name: Release Workflow | |
on: | |
schedule: | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
inputs: | |
overwrite: | |
description: Create a new release without using the database from the last one | |
type: boolean | |
required: true | |
default: "false" | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/tech_list.json' | |
jobs: | |
db-release: | |
name: "Database Release" | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install requirements | |
run: | | |
python -m pip install --upgrade pip | |
pip install --no-deps -r requirements.txt | |
pip install --no-deps . | |
pip install pylint pytest | |
- name: "Download the latest published database" | |
if: ${{ github.event.inputs.overwrite == 'false' }} | |
uses: "robinraju/[email protected]" | |
continue-on-error: true | |
with: | |
repository: "Cyberwatch/HashThePlanet" | |
latest: true | |
fileName: "hashtheplanet.db" | |
tarBall: false | |
zipBall: false | |
out-file-path: "dist/" | |
- name: "Update the database" | |
run: | | |
hashtheplanet --input src/tech_list.json --output dist/hashtheplanet.db | |
- name: "Publish the daily release with the tag: ${{ steps.date.outputs.date }}" | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "${{ steps.date.outputs.date }}" | |
prerelease: false | |
title: "Database release: ${{ steps.date.outputs.date }}" | |
files: | | |
dist/hashtheplanet.db | |
- name: "Publish the daily release with the tag: latest" | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: false | |
title: "Database release: Latest" | |
files: | | |
dist/hashtheplanet.db |