From a445b29d923a9b69cfd94eb053dd0fe068b787a8 Mon Sep 17 00:00:00 2001 From: "S. Suprun" Date: Sun, 28 Nov 2021 21:48:41 +0300 Subject: [PATCH] Init CD (#6) --- .github/workflows/deploy_commit.yml | 25 +++++++++++++++++++++++++ .github/workflows/deploy_release.yml | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/deploy_commit.yml create mode 100644 .github/workflows/deploy_release.yml diff --git a/.github/workflows/deploy_commit.yml b/.github/workflows/deploy_commit.yml new file mode 100644 index 0000000..c0b0a60 --- /dev/null +++ b/.github/workflows/deploy_commit.yml @@ -0,0 +1,25 @@ +name: Deploy commit + +on: workflow_dispatch + +jobs: + + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.3 + with: + fetch-depth: 0 + - name: 'Get version' + id: releasetag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + with: + fallback: 0.1.0 + - name: Release pushed commit + run: | + curl \ + -X POST \ + -H "Authorization: token ${{ secrets.PERSONAL_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/donkey-engine/deploy/actions/workflows/deploy_commit.yml/dispatches \ + -d '{"ref": "master", "inputs": {"commit": "${GITHUB_SHA}", "branch": "${GITHUB_REF##*/}", "repo": "wsbackend", "release": "${{ steps.releasetag.outputs.tag }}"}}' diff --git a/.github/workflows/deploy_release.yml b/.github/workflows/deploy_release.yml new file mode 100644 index 0000000..be9edf4 --- /dev/null +++ b/.github/workflows/deploy_release.yml @@ -0,0 +1,20 @@ +name: Deploy release + +on: + release: + types: [published] + +jobs: + + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.3 + - name: Release pushed commit + run: | + curl \ + -X POST \ + -H "Authorization: token ${{ secrets.PERSONAL_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/donkey-engine/deploy/actions/workflows/deploy_release.yml/dispatches \ + -d '{"ref": "master", "inputs": {"repo": "wsbackend", "release": "${{ github.event.release.tag_name }}"}}'