Skip to content

Commit 28df928

Browse files
authored
Merge pull request #34 from Djelibeybi/tidy-devops-actions-example
Tidy up the OCI DevOps deployment with GitHub Actions examples
2 parents 383c311 + d270b34 commit 28df928

File tree

3 files changed

+125
-147
lines changed

3 files changed

+125
-147
lines changed
Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: OCI Deploy
22
# Controls when the workflow will run
33
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
55
push:
66
branches: [ "main"]
77

88
jobs:
99
get-ocir-repository-test:
1010
runs-on: ubuntu-latest
11-
name: Invoke OCI Deployment on to OKE .
11+
name: Invoke OCI Deployment on to OKE
1212
env:
1313
OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }}
1414
OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }}
@@ -17,6 +17,9 @@ jobs:
1717
OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }}
1818

1919
steps:
20+
- name: Check out code
21+
uses: actions/checkout@v2
22+
2023
- name: Get or create an OCIR Repository
2124
uses: oracle-actions/[email protected]
2225
id: get-ocir-repository
@@ -30,36 +33,19 @@ jobs:
3033
with:
3134
auth_token: ${{ secrets.OCI_AUTH_TOKEN }}
3235

33-
- name: Check out code
34-
uses: actions/checkout@v2
35-
3636
- name: Tag and push a container image
3737
id: tag-and-push-image
3838
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"
4341
4442
- name: Generate deploy arguments
4543
id: create-json
4644
run: |
47-
echo "::set-output name=metadata::{\"created_by\":\"$GITHUB_ACTOR\",\"triggered_by\":\"$GITHUB_EVENT_NAME\"}"
4845
echo "::set-output name=deployargs::{\"items\":[{\"name\":\"namespace\",\"value\":\"ns-github\"},{\"name\":\"image_tag\",\"value\":\"$GITHUB_RUN_NUMBER\"}]}"
4946
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-
5747
- name: Invoke deployment pipeline
5848
uses: oracle-actions/[email protected]
5949
id: invoke-deployments
6050
with:
6151
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

Comments
 (0)