12
12
- name : set up go
13
13
uses : actions/setup-go@v3
14
14
with :
15
- go-version : 1.18
15
+ go-version : 1.19
16
16
id : go
17
17
18
- - name : git clone
19
- uses : actions/checkout@v3
20
-
21
- - name : clone plugins repository
22
- uses : actions/checkout@v3
23
- with :
24
- repository : nextmv-io/plugins
25
- path : ${{env.RESOURCES}}
26
- ref : develop
27
- ssh-key : ${{ secrets.NEXTMVBOT_SSH_KEY }}
28
- ssh-known-hosts : ssh-keyscan github.com
29
-
30
18
- name : setup SSH Keys and known_hosts
31
19
run : |
32
20
mkdir -p ~/.ssh
@@ -37,17 +25,28 @@ jobs:
37
25
- name : use ssh instead of https for git
38
26
run :
git config --global url."[email protected] :".insteadOf "https://github.com/"
39
27
40
- # Installs Nextmv CLI dependency regardless of the distribution.
41
- - name : install Nextmv CLI dependency
42
- run : |
43
- NEXTMV_API_KEY=${{ secrets.API_KEY_PROD }} NEXTMV_BASE_URL=https://api.cloud.nextmv.io bash <(curl -s "https://cloud.nextmv.io/install-cli.txt")
44
- mv ~/.nextmv/nextmv /usr/local/bin/nextmv
45
- chmod a+x /usr/local/bin/nextmv
28
+ - name : initialize local branch name
29
+ run : echo "LOCAL_BRANCH=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV
46
30
47
- - name : configure Nextmv CLI
48
- run : |
49
- nextmv configure -a ${{ secrets.API_KEY_PROD }}
50
- nextmv activate -t local -r 123
31
+ # Gets the token and stores it in a variable.
32
+ - name : export local branch
33
+ run : echo "BRANCH_CHECK=$(git ls-remote --heads https://github.com/nextmv-io/plugins ${{ env.LOCAL_BRANCH }})" >> $GITHUB_ENV
34
+
35
+ - name : override with develop if empty
36
+ if : " ${{ env.BRANCH_CHECK == '' }}"
37
+ run : echo "LOCAL_BRANCH=develop" >> $GITHUB_ENV
38
+
39
+ - name : git clone
40
+ uses : actions/checkout@v3
41
+
42
+ - name : clone plugins repository
43
+ uses : actions/checkout@v3
44
+ with :
45
+ repository : nextmv-io/plugins
46
+ path : ${{ env.RESOURCES }}
47
+ ref : ${{ env.LOCAL_BRANCH }}
48
+ ssh-key : ${{ secrets.NEXTMVBOT_SSH_KEY }}
49
+ ssh-known-hosts : ssh-keyscan github.com
51
50
52
51
- name : export sdk path used in this action
53
52
run : echo "SDK_PATH=$(pwd)" >> $GITHUB_ENV
@@ -60,11 +59,11 @@ jobs:
60
59
go mod edit -replace=github.com/nextmv-io/sdk=${{env.SDK_PATH}}
61
60
62
61
# Build the plugins.
63
- REMOVE_TRIMPATH=1 NEXTMV_LIBRARY_PATH=${{ env.NEXTMV_LIBRARY_PATH }} bash scripts/build.sh
62
+ REMOVE_TRIMPATH=1 NEXTMV_LIBRARY_PATH=${{ env.NEXTMV_LIBRARY_PATH }} bash scripts/build.sh > /dev/null 2>&1
64
63
working-directory : ${{env.RESOURCES}}
65
64
66
65
- name : go build
67
66
run : go build -v ./...
68
67
69
68
- name : go test
70
- run : NEXTMV_LIBRARY_PATH=${{ env.NEXTMV_LIBRARY_PATH }} NEXTMV_TOKEN=$(nextmv token) go test ./...
69
+ run : NEXTMV_LIBRARY_PATH=${{ env.NEXTMV_LIBRARY_PATH }} NEXTMV_TOKEN=${{ secrets.NEXTMV_TOKEN }} go test ./...
0 commit comments