diff --git a/.github/workflows/build-module.yml b/.github/workflows/build-module.yml index 5c45fb8..1cb5691 100644 --- a/.github/workflows/build-module.yml +++ b/.github/workflows/build-module.yml @@ -1,13 +1,17 @@ name: Create Release on Tag on: - release: - types: - - published + push: + tags: + - "v*.*.*" + workflow_call: + inputs: + tag_name: + required: true + type: string jobs: generate-config: - if: github.event.release.tag_name =~ '^v[0-9]+\.[0-9]+\.[0-9]+$' # Условие для проверки формата тега runs-on: ubuntu-latest outputs: job-config: ${{ steps.generate-config.outputs.job-config }} @@ -22,7 +26,12 @@ jobs: - name: Get OpenWRT version from tag id: get_version - run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV + run: | + if [ "${{ github.event_name }}" == "workflow_call" ]; then + echo "VERSION=${{ inputs.tag_name/v/}}" >> $GITHUB_ENV + else + echo "VERSION=${GITHUB_REF/refs/tags/v/}" >> $GITHUB_ENV + fi - name: Install dependencies run: npm install diff --git a/.github/workflows/run-release.yml b/.github/workflows/run-release.yml index 8e86081..c1148fe 100644 --- a/.github/workflows/run-release.yml +++ b/.github/workflows/run-release.yml @@ -52,4 +52,10 @@ jobs: -d "$(jq -n --arg tag "${{ steps.get_release.outputs.release_tag }}" \ --arg name "Build amnezia wg for all devices with openwrt ${{ steps.get_release.outputs.release_tag }}" \ --arg body "$ART" \ - '{ tag_name: $tag, name: $name, body: $body }')" \ No newline at end of file + '{ tag_name: $tag, name: $name, body: $body }')" + + - name: Run build job + if: steps.check_release.outputs.release_exists == 'false' + uses: .github/workflows/build-module.yml + with: + tag_name: ${{ steps.get_release.outputs.release_tag }} \ No newline at end of file