From 50f51d657b7d96b0a6785fc889a88486e3f41d70 Mon Sep 17 00:00:00 2001 From: makame Date: Sun, 23 Feb 2020 17:05:26 +0100 Subject: [PATCH] fix cicd --- .github/workflows/auto_rebase.yml | 24 ++++++++++++++++++++ .github/workflows/auto_revert.yml | 19 ++++++++++++++++ .github/workflows/auto_wip.yml | 12 ++++++++++ .github/workflows/npm_develop.yml | 13 +++++++++++ .github/workflows/npm_notify_release.yml | 28 ++++++++++++++++++++++++ 5 files changed, 96 insertions(+) create mode 100644 .github/workflows/auto_rebase.yml create mode 100644 .github/workflows/auto_revert.yml create mode 100644 .github/workflows/auto_wip.yml create mode 100644 .github/workflows/npm_notify_release.yml diff --git a/.github/workflows/auto_rebase.yml b/.github/workflows/auto_rebase.yml new file mode 100644 index 0000000..2bdd6b4 --- /dev/null +++ b/.github/workflows/auto_rebase.yml @@ -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/rebase@1.2 + 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." \ No newline at end of file diff --git a/.github/workflows/auto_revert.yml b/.github/workflows/auto_revert.yml new file mode 100644 index 0000000..17cf848 --- /dev/null +++ b/.github/workflows/auto_revert.yml @@ -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/revert@v0.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/auto_wip.yml b/.github/workflows/auto_wip.yml new file mode 100644 index 0000000..559330e --- /dev/null +++ b/.github/workflows/auto_wip.yml @@ -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/action@v1.0.0 diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index faa40fd..2fd09e9 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -20,6 +20,15 @@ jobs: - 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: @@ -30,6 +39,8 @@ jobs: 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() @@ -41,3 +52,5 @@ jobs: FAILED - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} + --- + ${{ steps.get_commitmsg.outputs.commitmsg }} diff --git a/.github/workflows/npm_notify_release.yml b/.github/workflows/npm_notify_release.yml new file mode 100644 index 0000000..fc63a79 --- /dev/null +++ b/.github/workflows/npm_notify_release.yml @@ -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/github-script@0.2.0 + 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