Skip to content

Commit 3104394

Browse files
committed
Bring workflows and actions to locally
1 parent 84c1f31 commit 3104394

15 files changed

Lines changed: 860 additions & 5 deletions
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#
2+
# This action allows you to get a masked secret from Azure Key Vault using the Azure CLI.
3+
# It implies that the action az-login, is used before this action in the same job as where the secrets will be obtained.
4+
# This action is designed to be reusable and can be called from other workflows.
5+
#
6+
# HOW TO USE:
7+
#
8+
# To call this reusable action, copy the code between === lines to workflow file,
9+
# uncomment and adjust "uses" as needed (use the latest tag available).
10+
# ======================================================================
11+
# on:
12+
# pull_request:
13+
# types: [opened, reopened, labeled, unlabeled]
14+
#
15+
# permissions:
16+
# id-token: write
17+
# contents: read
18+
#
19+
# (...)
20+
# steps:
21+
# (...)
22+
# # First, login to Azure using the az-devops-login action
23+
# - name: Azure Login
24+
# uses: OutSystems/rd.github-reusable-workflows/.github/actions/az-devops-login@vVersionHash
25+
# with:
26+
# subscription-id: ${{ AZURE_subscription-id }}
27+
# tenant-id: ${{ AZURE_TENANT_ID }}
28+
# client-id: ${{ AZURE_CLIENT_ID }}
29+
#
30+
# # Then, multiple calls to the az-keyvault-get action can be made to retrieve different secrets
31+
# # from the Azure Key Vault. The secrets will be masked in the logs.
32+
#
33+
# - name: Get KeyVault Secret 1
34+
# id: GetAzKeyVaultSecret_1
35+
# uses: OutSystems/rd.github-reusable-workflows/.github/actions/az-keyvault-get@vVersionHash
36+
# with:
37+
# keyvault-name: ${{ AZURE_KEYVAULT_NAME }}
38+
# key-name: ${{ AZURE_KEYVAULT_SECRET_NAME_1 }}
39+
#
40+
# - name: Get KeyVault Secret 2
41+
# id: GetAzKeyVaultSecret_2
42+
# uses: OutSystems/rd.github-reusable-workflows/.github/actions/az-keyvault-get@vVersionHash
43+
# with:
44+
# keyvault-name: ${{ AZURE_KEYVAULT_NAME }}
45+
# key-name: ${{ AZURE_KEYVAULT_SECRET_NAME_2 }}
46+
#
47+
# - name: Use KeyVault Secrets
48+
# run: |
49+
# echo "The secret 1 value is: ${{ steps.GetAzKeyVaultSecret_1.outputs.az-keyvault-value }}"
50+
# echo "The secret 2 value is: ${{ steps.GetAzKeyVaultSecret_2.outputs.az-keyvault-value }}"
51+
#
52+
# ======================================================================
53+
#
54+
name: Azure KeyVault Get Value
55+
description: 'Get a secret from Azure Key Vault.'
56+
inputs:
57+
keyvault-name:
58+
description: 'Name of the Azure Key Vault.'
59+
required: false
60+
default: 'kv-ui-components'
61+
key-name:
62+
description: 'Name of the secret to retrieve.'
63+
required: true
64+
default: ''
65+
outputs:
66+
az-keyvault-value:
67+
description: 'The Azure key value.'
68+
value: ${{ steps.GetAzKeyVaultSecret.outputs.az-keyvault-secret }}
69+
70+
runs:
71+
using: composite
72+
steps:
73+
- name: Azure KeyVault get Value
74+
uses: azure/cli@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
75+
id: GetAzKeyVaultSecret
76+
with:
77+
inlineScript: |
78+
secretValue=$(az keyvault secret show --name "${{ inputs.key-name }}" --vault-name "${{ inputs.keyvault-name }}" --query "value" --output tsv)
79+
echo "::add-mask::$secretValue"
80+
echo "az-keyvault-secret=$secretValue" >> $GITHUB_OUTPUT
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#
2+
# This action allows you to get a secret from Azure Key Vault using the Azure CLI.
3+
# The default values are set to the OutSystems Azure subscription and tenant used by the UI Components team.
4+
#
5+
# HOW TO USE:
6+
#
7+
# To call this reusable action, copy the code between === lines to workflow file,
8+
# uncomment and adjust "uses" as needed (use the latest tag available).
9+
# ======================================================================
10+
# on:
11+
# pull_request:
12+
# types: [opened, reopened, labeled, unlabeled]
13+
#
14+
# (...)
15+
# steps:
16+
# (...)
17+
# - name: Get KeyVault Secret
18+
# uses: OutSystems/rd.github-reusable-workflows/.github/actions/az-devops-login@vVersionHash
19+
# with:
20+
# subscription-id: ${{ AZURE_subscription-id }}
21+
# tenant-id: ${{ AZURE_TENANT_ID }}
22+
# client-id: ${{ AZURE_CLIENT_ID }}
23+
#
24+
# ======================================================================
25+
#
26+
name: Azure Login
27+
description: 'Logins to Azure using the Azure CLI.'
28+
inputs:
29+
subscription-id:
30+
description: 'Azure subscription ID.'
31+
required: false
32+
default: ''
33+
tenant-id:
34+
description: 'Azure tenant ID.'
35+
required: false
36+
default: ''
37+
client-id:
38+
description: 'Azure client ID.'
39+
required: false
40+
default: ''
41+
42+
runs:
43+
using: composite
44+
steps:
45+
- name: Azure DevOps Login
46+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
47+
with:
48+
client-id: ${{ inputs.client-id }}
49+
tenant-id: ${{ inputs.tenant-id }}
50+
subscription-id: ${{ inputs.subscription-id }}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#
2+
# This action enables to perform signed commits.
3+
# It uses the crazy-max/ghaction-import-gpg action to import the GPG key and set up the git configuration for signing commits.
4+
# The action then performs a manual git commit and push to the specified branch.
5+
#
6+
# HOW TO USE:
7+
#
8+
# To call this reusable action, copy the code between === lines to workflow file,
9+
# uncomment and adjust "uses" as needed (use the latest tag available).
10+
# ======================================================================
11+
# on:
12+
#
13+
# (...)
14+
# steps:
15+
# (...)
16+
# - name: Commit changes Signed
17+
# uses: OutSystems/rd.github-reusable-workflows/.github/actions/signed-commit@vTagVersion
18+
# with:
19+
# commit-branch: ${{ BRANCH_NAME }}
20+
# commit-message: ${{ COMMIT_MESSAGE }}
21+
# commit-new-files: ${{ true || false }}
22+
# gpg-priv-key: ${{ GPG_SIGN_KEY }}
23+
# gpg-pass-phrase: ${{ GPG_PASSPHRASE }}
24+
#
25+
# ======================================================================
26+
#
27+
28+
name: Signed GPG Commit
29+
description: 'Prepare and sign the commit signed'
30+
inputs:
31+
commit-branch:
32+
description: 'Branch where to commit.'
33+
required: true
34+
default: ''
35+
commit-message:
36+
description: 'Commit message.'
37+
required: true
38+
default: ''
39+
commit-new-files:
40+
description: 'Defines if a `git add.` should be made or not.'
41+
required: false
42+
default: false
43+
gpg-priv-key:
44+
description: 'GPG Private key.'
45+
required: true
46+
default: ''
47+
gpg-pass-phrase:
48+
description: 'GPG passphrase.'
49+
required: false
50+
default: '""'
51+
52+
runs:
53+
using: composite
54+
steps:
55+
- name: Import and load GPG key
56+
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
57+
with:
58+
gpg_private_key: ${{ inputs.gpg-priv-key }}
59+
passphrase: ${{ inputs.gpg-pass-phrase }}
60+
git_user_signingkey: true
61+
git_commit_gpgsign: true
62+
63+
- name: Add new files (if needed)
64+
shell: bash
65+
if: ${{ inputs.commit-new-files == 'true' }}
66+
run: |
67+
git add .
68+
69+
- name: Manual git commit
70+
shell: bash
71+
run: |
72+
git commit -m "${{ inputs.commit-message }}"
73+
git push origin ${{ inputs.commit-branch }}

.github/workflows/build.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ permissions:
1616
jobs:
1717
build:
1818
name: Build TypeScript Project
19-
uses: OutSystems/ui-components.github-reusable-workflows/.github/workflows/ts-build-project.yaml@7ffd7f90f6e5016bd92d0e050d2516084b99c2f6 #v0.2.5
19+
#uses: OutSystems/ui-components.github-reusable-workflows/.github/workflows/ts-build-project.yaml@7ffd7f90f6e5016bd92d0e050d2516084b99c2f6 #v0.2.5
20+
uses: .github/workflows/templates/ts-build-project.yaml
2021
with:
2122
github-ref: ${{ github.ref }}
2223
run-jest-tests: false

.github/workflows/pre-release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ permissions:
2323
jobs:
2424
create-release-candidate:
2525
name: Create Release Candidate
26-
uses: OutSystems/ui-components.github-reusable-workflows/.github/workflows/pre-release.yaml@7ffd7f90f6e5016bd92d0e050d2516084b99c2f6 #v0.2.5
26+
#uses: OutSystems/ui-components.github-reusable-workflows/.github/workflows/pre-release.yaml@7ffd7f90f6e5016bd92d0e050d2516084b99c2f6 #v0.2.5
27+
uses: .github/workflows/templates/pre-release.yaml
2728
with:
2829
new-version: ${{ inputs.new-version }}
2930
release-date: ${{ inputs.release-date }}

.github/workflows/release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ permissions:
2323
jobs:
2424
set-release-latest:
2525
name: Set Release as Latest
26-
uses: OutSystems/ui-components.github-reusable-workflows/.github/workflows/release.yaml@7ffd7f90f6e5016bd92d0e050d2516084b99c2f6 #v0.2.5
26+
#uses: OutSystems/ui-components.github-reusable-workflows/.github/workflows/release.yaml@7ffd7f90f6e5016bd92d0e050d2516084b99c2f6 #v0.2.5
27+
uses: .github/workflows/templates/release.yaml
2728
with:
2829
new-version: ${{ inputs.new-version }}
2930
update-prerelease-into-latest: ${{ inputs.update-prerelease-into-latest }}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
These workflows were copied from the repo https://github.com/OutSystems/ui-components.github-reusable-workflows.
2+
3+
The reason to copy the workflows here, is due to this repos visibility being public, being that as such it cannot use workflows in private repos.
4+
5+
Do not change these files directly.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#
2+
# This workflow aggregates 3 actions
3+
# 1. Checks if any (or all) changes in a PR are on files NOT owned by the author and if so adds an inner sourcing label (or inner sourcing strict).
4+
#
5+
# 2. Prevents merging pull requests that don't follow the title convention:
6+
# The title convention is
7+
# "+semver: <minor|major|patch> <ticket id> <description>"
8+
# OR
9+
# "<ticket id> <description>"
10+
# depending on the 'validate-semVer' input value,
11+
# where ´+semver: <minor|major|patch> ´ section is optional, and <ticket id> must be a JIRA issue identifier.
12+
#
13+
# 3. Prevents merging pull requests that don't follow the label conventions.
14+
# The rules to allow merging a pull request are:
15+
# - it must have at least one label that describes the type of pull request
16+
# - it must not have the "do not merge" label
17+
#
18+
# It assumes the code owners file is is `.github/CODEOWNERS` but you can override the configuration with the input variable `codeowners-path`.
19+
#
20+
# HOW TO USE:
21+
#
22+
# To call this reusable workflow, copy the code between === lines to a new workflow file,
23+
# uncomment and adjust "uses" as needed (use the latest tag available).
24+
# ======================================================================
25+
#
26+
# name: Check if pull request is inner sourcing
27+
#
28+
# on:
29+
# pull_request:
30+
# types:
31+
# - opened
32+
#
33+
# jobs:
34+
# inner-sourcing:
35+
# name: Check if pull request is inner sourcing
36+
# uses: OutSystems/rd.github-reusable-workflows/.github/workflows/label-and-validate-pt.yaml@v2.0.4
37+
# secrets: inherit
38+
#
39+
# ======================================================================
40+
41+
name: Label and Validate the PR
42+
43+
on:
44+
workflow_call:
45+
inputs:
46+
codeowners-path:
47+
required: false
48+
type: string
49+
default: ./.github/CODEOWNERS
50+
51+
jobs:
52+
inner-sourcing:
53+
runs-on: ubuntu-latest
54+
if: github.actor != 'dependabot[bot]'
55+
steps:
56+
#- name: Run pr-inner-sourcing-label action
57+
# uses: OutSystems/rd.github-reusable-workflows/.github/actions/add-inner-sourcing-label@v2.0.7
58+
# with:
59+
# github-token-for-labelling: ${{ secrets.GITHUB_TOKEN }}
60+
# github-token-for-team-membership: ${{ secrets.INNERSOURCING_PR_DATA_GITHUB_TOKEN }}
61+
# codeowners-path: ./CODEOWNERS
62+
- name: Check PR Title
63+
#uses: OutSystems/rd.github-reusable-workflows/.github/actions/validate-pr-title@v2.0.7
64+
uses: .github/actions/validate-pr-title
65+
- name: Validate PR labels
66+
#uses: OutSystems/rd.github-reusable-workflows/.github/actions/validate-pr-labels@v2.0.7
67+
uses: .github/actions/validate-pr-labels

0 commit comments

Comments
 (0)