Skip to content

Commit 4733133

Browse files
authored
Merge pull request #141 from OutSystems/ROU-4580-SIGN-COMMITS
ROU-4580: Make the bot commits signed
2 parents 780db96 + 56641ac commit 4733133

5 files changed

Lines changed: 221 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'manual-git-commit'
2+
description: 'Runs the git command to commit'
3+
inputs:
4+
branch:
5+
description: 'Branch where to commit.'
6+
required: true
7+
default: ''
8+
message:
9+
description: 'Commit message.'
10+
required: true
11+
default: ''
12+
newFiles:
13+
description: 'Defines if a `git add.` should be made or not.'
14+
required: false
15+
default: false
16+
17+
runs:
18+
using: composite
19+
steps:
20+
- name: Add new files (if needed)
21+
shell: bash
22+
if: ${{ inputs.newFiles }}
23+
run: |
24+
git add .
25+
26+
- name: Manual git commit
27+
shell: bash
28+
run: |
29+
git commit -m "${{ inputs.message }}"
30+
git push origin ${{ inputs.branch }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 'setup-gpg'
2+
description: 'Prepare to get following commits signed'
3+
inputs:
4+
gpgPriv:
5+
description: 'GPG Private key'
6+
required: true
7+
default: ''
8+
gpgPassPhrase:
9+
description: 'GPG passphrase'
10+
required: false
11+
default: '""'
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Import and load GPG key
17+
uses: crazy-max/ghaction-import-gpg@v6
18+
with:
19+
gpg_private_key: ${{ inputs.gpgPriv }}
20+
passphrase: ${{ inputs.gpgPassPhrase }}
21+
git_user_signingkey: true
22+
git_commit_gpgsign: true
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 'signed-gpg-commit'
2+
description: 'Prepare and sign the commit signed'
3+
inputs:
4+
branch:
5+
description: 'Branch where to commit.'
6+
required: true
7+
default: ''
8+
message:
9+
description: 'Commit message.'
10+
required: true
11+
default: ''
12+
newFiles:
13+
description: 'Defines if a `git add.` should be made or not.'
14+
required: false
15+
default: false
16+
gpgPriv:
17+
description: 'GPG Private key'
18+
required: true
19+
default: ''
20+
gpgPassPhrase:
21+
description: 'GPG passphrase'
22+
required: false
23+
default: '""'
24+
25+
runs:
26+
using: composite
27+
steps:
28+
- name: Setup GPG to sign commits
29+
uses: ./.github/setup-gpg/
30+
with:
31+
gpgPriv: ${{ inputs.gpgPriv }}
32+
gpgPassPhrase: ${{ inputs.gpgPassPhrase }}
33+
34+
- name: Perform git commit
35+
uses: ./.github/manual-commit/
36+
with:
37+
branch: ${{ inputs.branch }}
38+
message: ${{ inputs.message }}
39+
newFiles: ${{ inputs.newFiles }}

.github/workflows/dev-pr.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: DEV_PR
2+
on:
3+
# Triggers the workflow on push events but only for the "dev" branch.
4+
pull_request:
5+
branches: ['dev']
6+
7+
workflow_dispatch:
8+
9+
jobs:
10+
eslint:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
working-directory: ./
15+
steps:
16+
- name: Checkout branch dev
17+
uses: actions/checkout@v2
18+
19+
- uses: actions/setup-node@v1
20+
with:
21+
node-version: '16.x'
22+
23+
- name: Install project dependencies
24+
run: npm install
25+
26+
- name: Run lint
27+
run: npm run lint
28+
29+
compile-code:
30+
needs: eslint
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout branch dev
34+
uses: actions/checkout@v2
35+
36+
- uses: actions/setup-node@v1
37+
with:
38+
node-version: '16.x'
39+
40+
- name: Install project dependencies
41+
run: npm install
42+
43+
- name: Compile code
44+
run: npm run build

.github/workflows/main-push.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: MAIN_PUSH
4+
5+
# Controls when the action will run.
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the dev branch
8+
push:
9+
branches: ['main']
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
eslint:
17+
runs-on: ubuntu-latest
18+
defaults:
19+
run:
20+
working-directory: ./
21+
steps:
22+
- name: Checkout branch main
23+
uses: actions/checkout@v2
24+
25+
- uses: actions/setup-node@v1
26+
with:
27+
node-version: '16.x'
28+
29+
- name: Install project dependencies
30+
run: npm install
31+
32+
- name: Run lint
33+
run: npm run lint
34+
35+
compile-code:
36+
needs: eslint
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout branch dev
40+
uses: actions/checkout@v2
41+
42+
- uses: actions/setup-node@v1
43+
with:
44+
node-version: '16.x'
45+
46+
- name: Install project dependencies
47+
run: npm install
48+
49+
- name: Compile code
50+
run: npm run build
51+
52+
documentation:
53+
needs: compile-code
54+
runs-on: ubuntu-latest
55+
56+
# Steps represent a sequence of tasks that will be executed as part of the job
57+
steps:
58+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
59+
- name: Checkout branch main
60+
uses: actions/checkout@v3
61+
with:
62+
ref: dev
63+
token: ${{ secrets.PAT }}
64+
65+
- name: Install graphviz
66+
run: sudo apt install -y graphviz
67+
68+
- uses: actions/setup-node@v3
69+
with:
70+
node-version: 16
71+
cache: 'npm'
72+
73+
- name: Install project dependencies
74+
run: npm install
75+
76+
- name: Generate documentation
77+
run: npm run docs
78+
79+
- name: Sign and commit documentation to branch dev
80+
uses: ./.github/os-git-actions/signed-commit/
81+
with:
82+
branch: main
83+
message: 'Update documentation [skip ci]'
84+
newFiles: true
85+
gpgPriv: ${{ secrets.GPG_SIGN_KEY }}
86+
gpgPassPhrase: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)