Skip to content

Commit

Permalink
refactor: merge release into cd (#7)
Browse files Browse the repository at this point in the history
* refactor: merge release into cd

* fix: handle both release and pr
  • Loading branch information
cristianmtr authored Oct 9, 2021
1 parent c7c9892 commit 3effad9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 52 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
29 changes: 20 additions & 9 deletions workflow-templates/executor-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ on:
push:
branches:
- $default-branch
release:
types:
- created
workflow_dispatch:
# pull_request:
# uncoment the line above to test CD push in a PR
# uncomment the above to test

jobs:
push-executors:
Expand All @@ -16,17 +19,25 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
# the action doesn't work on release events
- name: Get previous tag
id: previoustag
if: ${{ github.event_name != 'release' }}
id: previous_tag_action
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: ""
# this only works for newly released tags
- name: Get the version we just released
if: ${{ github.event_name == 'release' }}
id: previous_tag_custom
run: |
[[ ! "$GITHUB_REF" =~ refs/tags ]] && exit
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
- name: push to Hubble
id: push_exec
uses: jina-ai/action-hubble-push@v3
with:
git_tag: ${{ steps.previoustag.outputs.tag }}
run: |
bash ./.github/workflows/scripts/push.sh .
env:
exec_secret: ${{ secrets.SECRET }}
- run: echo push result ${{ steps.push_exec.outputs.exit_code}}
shell: bash
token: ${{ secrets.GH_TOKEN }}
GIT_TAG_ACTION: ${{ steps.previous_tag_action.outputs.tag }}
GIT_TAG_CUSTOM: ${{ steps.previous_tag_custom.outputs.tag }}

13 changes: 0 additions & 13 deletions workflow-templates/executor-release.properties.json

This file was deleted.

30 changes: 0 additions & 30 deletions workflow-templates/executor-release.yml

This file was deleted.

9 changes: 9 additions & 0 deletions workflow-templates/scripts/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ echo SECRET=`head -c 3 <(echo $exec_secret)`

rm secrets.json

echo GIT_TAG_CUSTOM = $GIT_TAG_CUSTOM
echo GIT_TAG_ACTION = $GIT_TAG_ACTION

export GIT_TAG=$GIT_TAG_ACTION
if [ -z "$GIT_TAG" ]
then
export GIT_TAG=$GIT_TAG_CUSTOM
fi

# we only push to a tag once,
# if it doesn't exist
echo git tag = $GIT_TAG
Expand Down

0 comments on commit 3effad9

Please sign in to comment.