Skip to content

Commit b907076

Browse files
committed
workflows
Signed-off-by: junior <junior@users.noreply.github.com>
1 parent d0483a9 commit b907076

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

.github/workflows/stack.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
#
4+
5+
# Creates and Publishes the Oracle Resource Manager stack - v0.0.5
6+
7+
name: Generate stacks and publish release
8+
9+
on:
10+
push:
11+
branches: [ main ]
12+
paths: ['VERSION']
13+
14+
jobs:
15+
16+
publish_stack:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Create stacks
23+
id: create_stacks
24+
run: |
25+
#
26+
STACKNAME=${{ github.event.repository.name }}
27+
STACK_FILES="*.tf schema.yaml README.md LICENSE VERSION .terraform.lock.hcl modules/"
28+
RELEASE=$(cat VERSION)
29+
ASSETS+="${STACKNAME}-stack.zip ${STACKNAME}-${RELEASE}.zip "
30+
echo "::group::Processing $STACKNAME"
31+
zip -r ${STACKNAME}-stack.zip $STACK_FILES -x "*.tfstat*" ".terraform/" || { printf '\n⛔ Unable to create %s stack.\n'; exit 1; }
32+
cp ${STACKNAME}-stack.zip ${STACKNAME}-${RELEASE}.zip || { printf '\n⛔ Unable to create %s stack.\n'; exit 1; }
33+
echo "::endgroup::"
34+
echo "::set-output name=assets::$ASSETS"
35+
echo "::set-output name=release::$RELEASE"
36+
echo "::set-output name=prefix::$STACKNAME"
37+
38+
- name: Prepare Release Notes
39+
run: |
40+
#
41+
printf '%s\n' '${{ steps.create_stacks.outputs.prefix }} Stack - v${{ steps.create_stacks.outputs.release }}' >release.md
42+
printf '%s\n' '' '## [![Deploy to Oracle Cloud][magic_button]][magic_stack]' >>release.md
43+
printf '%s\n' '' '' >>release.md
44+
printf '%s\n' '' '[magic_button]: https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg' >>release.md
45+
printf '%s\n' '' '[magic_stack]: https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/${{ github.repository }}/releases/download/${{ steps.create_stacks.outputs.release }}/${{ steps.create_stacks.outputs.prefix }}-${{ steps.create_stacks.outputs.release }}.zip' >>release.md
46+
47+
- name: Create Release
48+
run: gh release create ${{ steps.create_stacks.outputs.release }} --generate-notes -F release.md ${{ steps.create_stacks.outputs.assets }}
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: tfsec-pr-commenter
2+
on:
3+
pull_request:
4+
jobs:
5+
tfsec:
6+
name: tfsec PR commenter
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Clone repo
11+
uses: actions/checkout@master
12+
13+
- name: tfsec
14+
uses: tfsec/tfsec-pr-commenter-action@main
15+
with:
16+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tfsec.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
name: tfsec
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
pull_request:
12+
branches: [ "main" ]
13+
schedule:
14+
- cron: '18 15 * * 3'
15+
16+
jobs:
17+
tfsec:
18+
name: Run tfsec sarif report
19+
runs-on: ubuntu-latest
20+
permissions:
21+
actions: read
22+
contents: read
23+
security-events: write
24+
25+
steps:
26+
- name: Clone repo
27+
uses: actions/checkout@v3
28+
29+
- name: Run tfsec
30+
uses: aquasecurity/tfsec-sarif-action@9a83b5c3524f825c020e356335855741fd02745f
31+
with:
32+
sarif_file: tfsec.sarif
33+
34+
- name: Upload SARIF file
35+
uses: github/codeql-action/upload-sarif@v2
36+
with:
37+
# Path to SARIF file relative to the root of the repository
38+
sarif_file: tfsec.sarif

0 commit comments

Comments
 (0)