Skip to content

Commit

Permalink
Merge pull request #9 from makamekm/develop
Browse files Browse the repository at this point in the history
Release fixes
  • Loading branch information
makamekm authored Feb 23, 2020
2 parents 19245ea + 6a105d4 commit 8941598
Show file tree
Hide file tree
Showing 19 changed files with 740 additions and 81 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/auto_rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
issue_comment:
types: [created]
name: Automatic Rebase
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# https://github.community/t5/GitHub-Actions/Workflow-is-failing-if-no-job-can-be-ran-due-to-condition/m-p/38186#M3250
always_job:
name: Always run job
runs-on: ubuntu-latest
steps:
- name: Always run
run: echo "This job is used to prevent the workflow to fail when all other jobs are skipped."
19 changes: 19 additions & 0 deletions .github/workflows/auto_revert.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Automatic Revert

on:
issue_comment:
types: [created]

jobs:
revert-commit:

runs-on: ubuntu-latest

if: contains(github.event.comment.body, '/revert')

steps:
- uses: actions/checkout@v1
- name: Automatic Revert
uses: srt32/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/auto_wip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: WIP
on:
pull_request:
types: [ opened, synchronize, reopened, edited ]

jobs:
wip:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: wip/[email protected]
21 changes: 21 additions & 0 deletions .github/workflows/npm_all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Node.js Linting

on:
push:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm install
env:
NODE_ENV: development
- run: npm run lint
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
56 changes: 56 additions & 0 deletions .github/workflows/npm_develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Node.js Develop Test

on:
push:
branches:
- develop

jobs:
test_develop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm install
env:
NODE_ENV: development
- run: npm run lint
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name : GITHUB CONTEXT
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: get commit message
id: get_commitmsg
run: echo ::set-output name=commitmsg::$(git log --format=%B -n 1 ${{ github.event.after }})
- name: show commit message
run : echo ${{ steps.get_commitmsg.outputs.commitmsg }}
- name: send a success message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Figma React - ${{ github.ref }}
SUCCESSFULLY - test
Triggered by ${{ github.event_name }} event
https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }}
---
${{ steps.get_commitmsg.outputs.commitmsg }}
- name: send a fail message
uses: appleboy/telegram-action@master
if: failure()
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Figma React - ${{ github.ref }}
FAILED - test
Triggered by ${{ github.event_name }} event
https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }}
---
${{ steps.get_commitmsg.outputs.commitmsg }}
33 changes: 33 additions & 0 deletions .github/workflows/npm_master_release_patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,40 @@ jobs:
NODE_ENV: development
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "CICD"
- name: Temporarily disable "include administrators" branch protection
uses: makamekm/branch-protection-bot@master
if: always()
with:
access-token: ${{ secrets.GITHUB_TOKEN_CICD }}
enforce_admins: false
- run: npm run release:patch
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- name: Enable "include administrators" branch protection
uses: makamekm/branch-protection-bot@master
if: always()
with:
access-token: ${{ secrets.GITHUB_TOKEN_CICD }}
enforce_admins: true
- name: send a success message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Figma React - ${{ github.ref }}
SUCCESSFULLY - publish
Triggered by ${{ github.event_name }} event
https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }}
- name: send a fail message
uses: appleboy/telegram-action@master
if: failure()
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Figma React - ${{ github.ref }}
FAILED - publish
Triggered by ${{ github.event_name }} event
https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }}
28 changes: 28 additions & 0 deletions .github/workflows/npm_notify_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Node.js Public Release Notes

on:
release:

jobs:
test_develop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Extract tag name
id: tag
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
return context.payload.ref.replace(/\/refs\/tags\//, '');
- name: send release notes
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_PUBLIC_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
New version of Figma React ${{ steps.tag.outputs.result }} has been released
https://github.com/makamekm/figma-react/releases/tag/${{ steps.tag.outputs.result }}
https://www.npmjs.com/package/figma-react
35 changes: 34 additions & 1 deletion .github/workflows/npm_release_major.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- release/major

jobs:
publish_patch:
publish_major:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -24,7 +24,40 @@ jobs:
- run: git fetch origin
- run: git checkout -b master origin/master
- run: git merge release/major
- name: Temporarily disable "include administrators" branch protection
uses: makamekm/branch-protection-bot@master
if: always()
with:
access-token: ${{ secrets.GITHUB_TOKEN_CICD }}
enforce_admins: false
- run: npm run release:major
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- name: Enable "include administrators" branch protection
uses: makamekm/branch-protection-bot@master
if: always()
with:
access-token: ${{ secrets.GITHUB_TOKEN_CICD }}
enforce_admins: true
- name: send a success message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Figma React - ${{ github.ref }}
SUCCESSFULLY - publish
Triggered by ${{ github.event_name }} event
https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }}
- name: send a fail message
uses: appleboy/telegram-action@master
if: failure()
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Figma React - ${{ github.ref }}
FAILED - publish
Triggered by ${{ github.event_name }} event
https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }}
35 changes: 34 additions & 1 deletion .github/workflows/npm_release_minor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- release/minor

jobs:
publish_patch:
publish_minor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -24,7 +24,40 @@ jobs:
- run: git fetch origin
- run: git checkout -b master origin/master
- run: git merge release/minor
- name: Temporarily disable "include administrators" branch protection
uses: makamekm/branch-protection-bot@master
if: always()
with:
access-token: ${{ secrets.GITHUB_TOKEN_CICD }}
enforce_admins: false
- run: npm run release:minor
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- name: Enable "include administrators" branch protection
uses: makamekm/branch-protection-bot@master
if: always()
with:
access-token: ${{ secrets.GITHUB_TOKEN_CICD }}
enforce_admins: true
- name: send a success message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Figma React - ${{ github.ref }}
SUCCESSFULLY - publish
Triggered by ${{ github.event_name }} event
https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }}
- name: send a fail message
uses: appleboy/telegram-action@master
if: failure()
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Figma React - ${{ github.ref }}
FAILED - publish
Triggered by ${{ github.event_name }} event
https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }}
33 changes: 33 additions & 0 deletions .github/workflows/npm_release_patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,40 @@ jobs:
- run: git fetch origin
- run: git checkout -b master origin/master
- run: git merge release/patch
- name: Temporarily disable "include administrators" branch protection
uses: makamekm/branch-protection-bot@master
if: always()
with:
access-token: ${{ secrets.GITHUB_TOKEN_CICD }}
enforce_admins: false
- run: npm run release:patch
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- name: Enable "include administrators" branch protection
uses: makamekm/branch-protection-bot@master
if: always()
with:
access-token: ${{ secrets.GITHUB_TOKEN_CICD }}
enforce_admins: true
- name: send a success message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Figma React - ${{ github.ref }}
SUCCESSFULLY - publish
Triggered by ${{ github.event_name }} event
https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }}
- name: send a fail message
uses: appleboy/telegram-action@master
if: failure()
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Figma React - ${{ github.ref }}
FAILED - publish
Triggered by ${{ github.event_name }} event
https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ figmaReact.runFigmaReact(options).catch(err => {
- decorator // default 'observer'
- classAfterFix // default 'Generated'
- fileAfterFix // default '.generated'
- useBase64Images // default false
- typeFactory // default ({ props: componentProps }) => `string`
- prettierOptions // default
```
Expand All @@ -98,3 +99,4 @@ figmaReact.runFigmaReact(options).catch(err => {
`npm link`

This repository uses Git Flow

7 changes: 7 additions & 0 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
loadURLImages,
loadImages,
loadNodes,
loadURLPNGImages,
getHeaders
};

Expand Down Expand Up @@ -36,6 +37,12 @@ async function loadURLImages(vectorList, fileKey, headers) {
return await data.json();
}

async function loadURLPNGImages(fileKey, headers) {
data = await fetch(`${baseUrl}/v1/files/${fileKey}/images`, { headers });
const json = await data.json();
return json.meta.images;
}

async function loadImages(imageJSON) {
const images = imageJSON.images || {};
if (images) {
Expand Down
Loading

0 comments on commit 8941598

Please sign in to comment.