Generate Font and Publish #91
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 Font and Publish | |
on: | |
workflow_dispatch: | |
schedule: | |
# Every 1st and 15st of each month. Basically the library update itself every 15 days | |
- cron: "0 0 1,15 * *" | |
# Underscore key identifiers (some_identifier) -> Custom identifier defined within some script or the job itself (that is, is not part of GitHub action syntax) | |
# Dash key identifiers (some-identifier) -> Required by GitHub action, it's not defined by us | |
jobs: | |
check_if_there_is_a_new_release_update_available: | |
name: Check if there's a new release update available | |
runs-on: ubuntu-latest | |
outputs: | |
# 'update_available' came from 'has_new_release.dart' script | |
update_available: ${{ steps.there_is_a_new_update_available.outputs.update_available }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dart-lang/setup-dart@v1 | |
- name: Get dependencies | |
run: cd autoupdate && dart pub get && cd .. | |
- name: Check if there's a new update | |
id: "there_is_a_new_update_available" | |
run: dart run autoupdate/lib/has_new_release.dart | |
publish_new_release: | |
name: Publish new package release | |
needs: ["check_if_there_is_a_new_release_update_available"] | |
if: ${{ needs.check_if_there_is_a_new_release_update_available.outputs.update_available == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dart-lang/setup-dart@v1 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Get dependencies | |
run: cd autoupdate && dart pub get && cd .. | |
- name: Update pubspec.yaml [version] and [pixelarticons_version] | |
run: dart run autoupdate/lib/update.dart | |
- name: Generate commit message | |
id: commit_msg | |
run: dart run autoupdate/lib/commit_msg.dart | |
# Add, commit and push changes of the previous step (Update pubspec.yaml...) | |
- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version. | |
with: | |
message: ${{ steps.commit_msg.outputs.new_release_commit_msg }} | |
- name: Install requests python library | |
run: pip install requests | |
- name: Download latest release | |
run: python3 download/download.py | |
- name: Install fontify library | |
run: dart pub global activate fontify | |
- name: Run fontify to generate the icons font (.ttf) | |
run: dart pub global run fontify | |
- name: Create credentials file | |
run: echo $PUB_CREDENTIALS > ~/pub-credentials.json | |
env: | |
PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }} | |
- name: Add credentials to Dart folder | |
run: | | |
mkdir -p ${XDG_CONFIG_HOME:-${HOME:-default}}/dart | |
touch ${XDG_CONFIG_HOME:-${HOME:-default}}/dart/pub-credentials.json | |
cp ~/pub-credentials.json ${XDG_CONFIG_HOME:-${HOME:-default}}/dart/pub-credentials.json | |
env: | |
PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }} | |
- name: Format generated files | |
run: dart format . | |
- name: Publish | |
run: dart pub publish --force |