From 75f83908ddba49b127ea23fd9a40db9e6ac1f8ca Mon Sep 17 00:00:00 2001 From: Yurii Dukhovnyi Date: Wed, 18 Oct 2023 15:09:57 +0300 Subject: [PATCH] test --- .github/actions/deployment-action/action.yml | 10 ++++++++++ .../deployment-action/deployment-action.js | 8 ++++++++ .github/workflows/deployment.yml | 19 +++++++++++-------- 3 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 .github/actions/deployment-action/action.yml create mode 100644 .github/actions/deployment-action/deployment-action.js diff --git a/.github/actions/deployment-action/action.yml b/.github/actions/deployment-action/action.yml new file mode 100644 index 000000000..3c1fd1a78 --- /dev/null +++ b/.github/actions/deployment-action/action.yml @@ -0,0 +1,10 @@ +name: 'Deployment validation' +description: 'Validates if deployment action can be run' +# inputs: +# branch-name: # the branch +# description: 'Who to greet' +# required: true +# default: 'World' +runs: + using: 'node20' + main: 'deployment-action.js' diff --git a/.github/actions/deployment-action/deployment-action.js b/.github/actions/deployment-action/deployment-action.js new file mode 100644 index 000000000..127c64cd6 --- /dev/null +++ b/.github/actions/deployment-action/deployment-action.js @@ -0,0 +1,8 @@ +const core = require('@actions/core'); +const github = require('@actions/github'); + +try { + console.log(github.context.ref); +} catch(error) { + core.setFailed(error.message); +} \ No newline at end of file diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index cfbf28a8d..2f69860b5 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -1,16 +1,19 @@ name: Deployment on: - workflow_dispatch: - inputs: - version: - description: 'Version in semantic versioning format (i.e. 1.0.2)' - required: true + pull_request + # workflow_dispatch: + # inputs: + # version: + # description: 'Version in semantic versioning format (i.e. 1.0.2)' + # required: true jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Runs the deployment workflow in Bitrise - run: | - curl https://app.bitrise.io/app/${{ secrets.BITRISE_APP_ID }}/build/start.json --data '{"hook_info":{"type":"bitrise","build_trigger_token":"${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}"},"build_params":{"branch":"master","workflow_id":"publish_to_nexus","environments":[{"mapped_to":"NEW_VERSION","value":"${{ github.event.inputs.version }}","is_expand":true}]},"triggered_by":"curl"}' + - uses: ./.github/actions/deployment-action + # - uses: actions/checkout@v3 + # - name: Runs the deployment workflow in Bitrise + # run: | + # curl https://app.bitrise.io/app/${{ secrets.BITRISE_APP_ID }}/build/start.json --data '{"hook_info":{"type":"bitrise","build_trigger_token":"${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}"},"build_params":{"branch":"master","workflow_id":"publish_to_nexus","environments":[{"mapped_to":"NEW_VERSION","value":"${{ github.event.inputs.version }}","is_expand":true}]},"triggered_by":"curl"}'