Generate Word Cloud #1309
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
name: Generate Word Cloud | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: "0 5 * * *" | |
jobs: | |
GenerateWordCloud: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Dependencies | |
run: | |
CC=clang pip install -r requirements.txt | |
- name: Download Neologd Dictionary | |
run: | |
sh scripts/download_neologd_dict.sh | |
- name: Generate Word Cloud | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
API_SECRET_KEY: ${{ secrets.API_SECRET_KEY }} | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }} | |
run: python3 src/main.py | |
- name: Setup git | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
run: | | |
git config --local user.name GitHubActions | |
git config --local user.email "example@example.com" | |
git remote set-url origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
- name: Git push, tag, upload assets | |
run: | | |
git checkout master | |
git pull origin master | |
git add -A | |
DIFF=`git diff --cached --numstat | wc -l` | |
if [ $DIFF -eq 0 ]; then | |
exit 0 | |
fi | |
git commit -am 'GitHub Actions commit' --allow-empty | |
git push origin master | |
# git tag -m "GitHub Action auto commit tag" 1.0.0-`date "+%Y%m%d_%H%M%S"` | |
# git push origin --tags | |
- name: release version | |
id: release_version | |
run: | | |
echo ::set-output name=version::$(date "+%Y%m%d_%H%M%S") | |
# - name: makarov text | |
# id: makarov_text | |
# run: | | |
# echo ::set-output name=text::$(cat makarov_text.txt) | |
# - name: Create Release | |
# id: create_release | |
# uses: actions/create-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# tag_name: ${{ steps.release_version.outputs.version }} | |
# release_name: Release ${{ steps.release_version.outputs.version }} | |
# body: | | |
# ${{ steps.makarov_text.outputs.text }} | |
# draft: false | |
# prerelease: false | |
# - name: Upload Release Asset MakarovText | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: ./makarov_text.txt | |
# asset_name: makarov_text.txt | |
# asset_content_type: text/plain | |
# - name: Upload Release Asset Makarov Learned Data | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: ./makarov_learned_data.json | |
# asset_name: makarov_learned_data.json | |
# asset_content_type: application/json | |
# - name: Upload Release Asset Makarov trend tokyo wordcloud | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: trend_tokyo.png | |
# asset_name: trend_tokyo.png | |
# asset_content_type: image/png | |
# - name: Upload Release Asset Makarov twitter wordcloud | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: word_cloud_tweet.png | |
# asset_name: word_cloud_tweet.png | |
# asset_content_type: image/png | |
# - name: Upload Release Asset Makarov blog wordcloud | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: word_cloud_blog.png | |
# asset_name: word_cloud_blog.png | |
# asset_content_type: image/png | |
# - name: Upload Release Asset Makarov blog large wordcloud | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: word_cloud_blog_large.png | |
# asset_name: word_cloud_blog_large.png | |
# asset_content_type: image/png | |
# - name: Upload Release Asset Makarov word_cloud_tweet_alpha | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: word_cloud_tweet_alpha.png | |
# asset_name: word_cloud_tweet_alpha.png | |
# asset_content_type: image/png | |
# - name: Upload Release Asset Makarov word_cloud_tweet_face_profile_alpha | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: word_cloud_tweet_face_profile_alpha.png | |
# asset_name: word_cloud_tweet_face_profile_alpha.png | |
# asset_content_type: image/png | |
# - name: Upload Release Asset Makarov word_cloud_tweet_face_profile | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: word_cloud_tweet_face_profile.png | |
# asset_name: word_cloud_tweet_face_profile.png | |
# asset_content_type: image/png | |
# - name: Upload Release Asset Makarov word_cloud_tweet_twitter_bird_alpha | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: word_cloud_tweet_twitter_bird_alpha.png | |
# asset_name: word_cloud_tweet_twitter_bird_alpha.png | |
# asset_content_type: image/png | |
# - name: Upload Release Asset Makarov word_cloud_tweet_twitter_bird | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: word_cloud_tweet_twitter_bird.png | |
# asset_name: word_cloud_tweet_twitter_bird.png | |
# asset_content_type: image/png | |
# - name: Slack Notification with makarov | |
# uses: rtCamp/action-slack-notify@master | |
# env: | |
# SLACK_CHANNEL: github_actions | |
# SLACK_COLOR: '#3278BD' | |
# SLACK_ICON: https://1.bp.blogspot.com/-DU9jll2ZQ38/XexqGlVzO9I/AAAAAAABWdQ/m0lQONbEfSgEjIN14h7iIfRh8WS5qwrFACNcBGAsYHQ/s1600/gal_o_man.png | |
# SLACK_MESSAGE: ${{ steps.makarov_text.outputs.text }} | |
# SLACK_TITLE: Deploy wordcloud | |
# SLACK_USERNAME: wordcloud | |
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |