From 9f2d1d0383c38005be30c6e2900b5c60e8e2c92e Mon Sep 17 00:00:00 2001 From: NSMBot Date: Wed, 9 Feb 2022 11:03:18 +0000 Subject: [PATCH] Sync files with networkservicemesh/cmd-template This PR syncs files with https://github.com/networkservicemesh/cmd-template Revision: https://github.com/networkservicemesh/cmd-template/commits/28ab652d217fe427326d012068a8faabe1668de5 commit 28ab652d217fe427326d012068a8faabe1668de5 Author: Nikita Skrynnik <93182827+NikitaSkrynnik@users.noreply.github.com> Date: Wed Feb 9 18:01:55 2022 +0700 Add Release Action (#88) * check go.mod deps + create-release job Signed-off-by: Nikita Skrynnik * fix ci Signed-off-by: Nikita Skrynnik Co-authored-by: NSMBot Signed-off-by: NSMBot --- .github/workflows/release.yml | 58 ++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 48f88774..b1aa285d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,10 +6,66 @@ on: types: - completed workflows: - - 'ci' + - "ci" jobs: + check-gomod-deps: + name: Check go.mod Dependencies + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_branch, 'release/') }} + steps: + - name: Get tag + run: | + branch=${{github.event.workflow_run.head_branch}} + echo '::set-output name=tag::'${branch#release/} + id: get-tag-step + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Check go.mod deps + run: | + cat go.mod | + grep 'github.com/networkservicemesh/.* v' | + grep -v 'github.com/networkservicemesh/.* ${{ steps.get-tag-step.outputs.tag }}' || exit 0; + + exit 1; + + create-release: + name: Create Release + runs-on: ubuntu-latest + needs: check-gomod-deps + if: ${{ github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_branch, 'release/') }} + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: refs/heads/${{github.event.workflow_run.head_branch}} + + - name: Get tag + run: | + branch=${{github.event.workflow_run.head_branch}} + echo '::set-output name=tag::'${branch#release/} + id: get-tag-step + + - name: Push tag ${{ steps.get-tag-step.outputs.tag }} + run: | + git status + git tag ${{ steps.get-tag-step.outputs.tag }} + git push origin ${{ steps.get-tag-step.outputs.tag }} -f + + - name: Create release ${{ steps.get-tag-step.outputs.tag }} + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} + with: + tag_name: refs/tags/${{ steps.get-tag-step.outputs.tag }} + release_name: ${{ steps.get-tag-step.outputs.tag }} + draft: false + prerelease: false + docker: runs-on: ubuntu-latest + needs: check-gomod-deps if: ${{ github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_branch, 'release/') }} steps: - name: Get tag