1
1
name : OCI Deploy
2
2
# Controls when the workflow will run
3
3
on :
4
- # Triggers the workflow on push or pull request events but only for the "dev " branch
4
+ # Triggers the workflow on push or pull request events but only for the "main " branch
5
5
push :
6
6
branches : [ "main"]
7
7
8
8
jobs :
9
9
get-ocir-repository-test :
10
10
runs-on : ubuntu-latest
11
- name : Invoke OCI Deployment on to OKE .
11
+ name : Invoke OCI Deployment on to OKE
12
12
env :
13
13
OCI_CLI_USER : ${{ secrets.OCI_CLI_USER }}
14
14
OCI_CLI_TENANCY : ${{ secrets.OCI_CLI_TENANCY }}
17
17
OCI_CLI_REGION : ${{ secrets.OCI_CLI_REGION }}
18
18
19
19
steps :
20
+ - name : Check out code
21
+ uses : actions/checkout@v2
22
+
20
23
- name : Get or create an OCIR Repository
21
24
uses :
oracle-actions/[email protected]
22
25
id : get-ocir-repository
@@ -30,36 +33,19 @@ jobs:
30
33
with :
31
34
auth_token : ${{ secrets.OCI_AUTH_TOKEN }}
32
35
33
- - name : Check out code
34
- uses : actions/checkout@v2
35
-
36
36
- name : Tag and push a container image
37
37
id : tag-and-push-image
38
38
run : |
39
- ls -ltr
40
- docker build -t "${{ steps.get-ocir-repository.outputs.repo_path }}:${{github.run_number}}" .
41
- docker push "${{ steps.get-ocir-repository.outputs.repo_path }}:${{github.run_number}}"
42
-
39
+ docker build -t "${{ steps.get-ocir-repository.outputs.repo_path }}:$GITHUB_RUN_NUMBER" .
40
+ docker push "${{ steps.get-ocir-repository.outputs.repo_path }}:$GITHUB_RUN_NUMBER"
43
41
44
42
- name : Generate deploy arguments
45
43
id : create-json
46
44
run : |
47
- echo "::set-output name=metadata::{\"created_by\":\"$GITHUB_ACTOR\",\"triggered_by\":\"$GITHUB_EVENT_NAME\"}"
48
45
echo "::set-output name=deployargs::{\"items\":[{\"name\":\"namespace\",\"value\":\"ns-github\"},{\"name\":\"image_tag\",\"value\":\"$GITHUB_RUN_NUMBER\"}]}"
49
46
50
-
51
- - name : Display and save the generated JSON
52
- run : |
53
- echo '${{ steps.create-json.outputs.metadata }}' | jq
54
- echo '${{ steps.create-json.outputs.deployargs }}'
55
-
56
-
57
47
- name : Invoke deployment pipeline
58
48
uses :
oracle-actions/[email protected]
59
49
id : invoke-deployments
60
50
with :
61
51
command : devops deployment create-pipeline-deployment --pipeline-id ${{ secrets.DEPLOYMENT_PIPELINE_OCID }} --deployment-arguments ${{ toJSON(steps.create-json.outputs.deployargs) }}
62
- silent : false
63
-
64
-
65
-
0 commit comments