Skip to content

Commit

Permalink
chore: Change output directory structure to make copying files to rep…
Browse files Browse the repository at this point in the history
…os easier
  • Loading branch information
thelukewalton committed Aug 2, 2024
1 parent 1346357 commit 8e7a115
Show file tree
Hide file tree
Showing 23 changed files with 81 additions and 5,002 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ jobs:
git push --set-upstream origin ${{steps.branch_name.outputs.BRANCH_NAME}} -f
- name: Check if PR exists
run: echo "pr_exists=$(gh pr list -H ${{steps.branch_name.outputs.BRANCH_NAME}} --json number -q length)" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Create Pull Request
if: ${{env.pr_exists == 0 && steps.fetch_icons.outputs.files_changed == 'true'}}
run: |
gh pr create -B main -H ${{steps.branch_name.outputs.BRANCH_NAME}} --title "${{steps.title.outputs.TITLE}}" --body 'Created by the Zeta Icons bot'
run: gh pr create -B main -H ${{steps.branch_name.outputs.BRANCH_NAME}} --title "${{steps.title.outputs.TITLE}}" --body 'Created by the Zeta Icons bot'
env:
GITHUB_TOKEN: ${{ github.token }}
97 changes: 10 additions & 87 deletions .github/workflows/update_zeta_flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,92 +9,15 @@ on:

env:
flutter_branch: update-zeta-icons
flutter_repo: ZebraDevs/zeta_flutter

jobs:
publish_flutter:
runs-on: ubuntu-latest
name: Commit and raise PR in Zeta Flutter
steps:
- name: Check if existing icons branch exists
run: echo "branch_exists=$(git ls-remote --heads https://github.com/${{env.flutter_repo}}.git refs/heads/${{env.flutter_branch}} | wc -l)" >> $GITHUB_ENV
- name: Check if open PR exists
run: echo "pr_exists=$(gh pr list -R ${{env.flutter_repo}} -H ${{env.flutter_branch}} --json number -q length)" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
ref: ${{github.ref_name}}
- name: Get package version
id: package-version
uses: martinbeentjes/[email protected]
- name: Inject version
run: sed -i 's/VERSION_NUM/${{steps.package-version.outputs.current-version}}/g' outputs/definitions/icons.dart
- name: Push dart file to Zeta Flutter (branch exists)
uses: dmnemec/copy_file_to_another_repo_action@main
if: ${{env.branch_exists == 1}}
env:
API_TOKEN_GITHUB: ${{ secrets.PAT }}
with:
#TODO: pass file paths as inputs
source_file: "./outputs/definitions/icons.dart"
destination_repo: "${{env.flutter_repo}}"
destination_folder: "lib/src/assets"
destination_branch: "${{env.flutter_branch}}"
user_email: "[email protected]"
user_name: "zeta-icons-bot"
commit_message: "icons.dart"
- name: Push dart file to Zeta Flutter (branch does not exist)
if: ${{env.branch_exists == 0}}
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.PAT }}
with:
#TODO: pass file paths as inputs
source_file: "./outputs/definitions/icons.dart"
destination_repo: "${{env.flutter_repo}}"
destination_folder: "lib/src/assets"
destination_branch_create: "${{env.flutter_branch}}"
user_email: "[email protected]"
user_name: "zeta-icons-bot"
commit_message: "icons.dart"
- name: Push round icon font file to Zeta Flutter
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.PAT }}
with:
source_file: "./outputs/font/zeta-icons-round.ttf"
destination_repo: "${{env.flutter_repo}}"
destination_folder: "lib/src/assets/fonts"
destination_branch: "${{env.flutter_branch}}"
user_email: "[email protected]"
user_name: "zeta-icons-bot"
commit_message: "rounded font file"
- name: Push sharp icon font file to Zeta Flutter
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.PAT }}
with:
source_file: "./outputs/font/zeta-icons-sharp.ttf"
destination_repo: "${{env.flutter_repo}}"
destination_folder: "lib/src/assets/fonts"
destination_branch: "${{env.flutter_branch}}"
user_email: "[email protected]"
user_name: "zeta-icons-bot"
commit_message: "sharp font file"
- name: Create PR message
run: echo "pr_message=Updating to icons version ${{ steps.package-version.outputs.current-version }}" >> $GITHUB_ENV
- name: Open Zeta Flutter PR
uses: thecanadianroot/[email protected]
if: ${{env.pr_exists == 0}}
with:
token: ${{ secrets.PAT }}
base: main
head: ${{env.flutter_branch}}
title: "deps: Update zeta-icon library"
labels: icons
body: "${{env.pr_message}}"
repository: ${{env.flutter_repo}}
- name: Add comment to existing PR
if: ${{env.pr_exists != 0}}
run: gh pr comment -R ${{env.flutter_repo}} ${{env.flutter_branch}} --body '${{env.pr_message}}'
publish_flutter: #TODO: Rename this to deploy, I think that is a better name
uses: ./.github/workflows/copy-content.yml@UX-1145
needs: generate_tokens
if: ${{ needs.generate_tokens.outputs.changes == 'true' }}
secrets: inherit
with:
repo: ZebraDevs/zeta_flutter
branch: "update-zeta-icons"
source_dir: "./outputs/dart/."
destination_dir: "lib/generated/icons"
Loading

0 comments on commit 8e7a115

Please sign in to comment.