Skip to content

Commit b1c740d

Browse files
committed
Merge branch 'master' of github.com:/Ragdata/reusable-workflows
# Conflicts: # README.md
2 parents 8c1990e + ab84587 commit b1c740d

File tree

132 files changed

+6072
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+6072
-0
lines changed

.github/docs/SMS.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Enable SMS Notifications from GitHub Actions
2+
3+
#### You can get SMS notifications sent from your GitHub Actions using the [Twilio SMS GitHub Action](https://github.com/twilio-labs/actions-sms)
4+
5+
### Prerequisites
6+
7+
- Twillio [Account (FREE)](https://www.twilio.com/try-twilio)
8+
- Twillio [API Key & Secret](https://www.twilio.com/try-twilio)
9+
10+
### Usage
11+
12+
1. Set up your credentials in secrets in your repository and settings using the variable names `TWILIO_ACCOUNT_SID`, `TWILIO_API_KEY`, `TWILIO_API_SECRET`
13+
14+
15+
2. Add the following to your workflows:
16+
17+
```yml
18+
- name: 'Send SMS Notification'
19+
uses: twilio-labs/actions-sms@v1
20+
with:
21+
fromPhoneNumber: '+1(234)5678901'
22+
toPhoneNumber: '+1(234)3334444'
23+
message: 'Hello from Twilio'
24+
env:
25+
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
26+
TWILIO_API_KEY: ${{ secrets.TWILIO_API_KEY }}
27+
TWILIO_API_SECRET: ${{ secrets.TWILIO_API_SECRET }}
28+
```
29+
30+
### INPUTS
31+
32+
`fromPhoneNumber`
33+
`toPhoneNumber`
34+
`message`
35+
`TWILIO_ACCOUNT_SID`
36+
`TWILIO_API_KEY`
37+
`TWILIO_API_SECRET`
38+
39+
### OUTPUTS
40+
41+
`messageSid`

.github/docs/TIPS.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Tips & Tricks
2+
3+
### How to determine if a file exists within a GitHub Action
4+
5+
So, you need to write a conditional statement in a GitHub Action which tests whether or not a file or files exist within the current repository:
6+
7+
```shell
8+
- name: Check File Exists
9+
id: check-files
10+
uses: andstor/file-existence-action@v1
11+
with:
12+
files: "Dockerfile, README.md"
13+
14+
- name: File Exists
15+
if: steps.check-files.outputs.files_exists == 'true'
16+
run: |
17+
...
18+
```

.github/workflows/assign.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ==================================================================
2+
# AUTO-ASSIGN ISSUES REUSABLE WORKFLOW (GENERIC)
3+
# ==================================================================
4+
name: Auto-Assign Issues
5+
6+
run-name: ${{ github.actor }} initiated the Auto-Assign Issues workflow
7+
8+
on:
9+
10+
# called by other workflows
11+
workflow_call:
12+
# triggered manually
13+
workflow_dispatch:
14+
# when issues are opened
15+
issues:
16+
types: [opened]
17+
18+
jobs:
19+
20+
auto-assign:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: 'Auto-Assign Issues'
24+
uses: pozil/[email protected]
25+
with:
26+
assignees: Ragdata
27+
numOfAssignees: 1

.github/workflows/ci.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# ==================================================================
2+
# CONTINUOUS INTEGRATION REUSABLE WORKFLOW (GENERIC)
3+
# ==================================================================
4+
name: Build & Test
5+
6+
run-name: ${{ github.actor }} initiated Build & Test (Generic CI) workflow
7+
8+
on:
9+
10+
# called by another workflow
11+
workflow_call:
12+
# triggered manually
13+
workflow_dispatch:
14+
inputs:
15+
environment:
16+
description: 'environment'
17+
required: true
18+
type: environment
19+
default: 'dev'
20+
outputs:
21+
image-tag:
22+
description: 'image tag'
23+
value: ${{ jobs.build-and-test.outputs.image-tag }}
24+
pull_request:
25+
branches: [ master ]
26+
push:
27+
branches: [ master ]
28+
29+
# cancel any previously started runs of this workflow on this branch
30+
concurrency:
31+
group: ${{ github.ref }}-${{ github.workflow }}
32+
cancel-in-progress: true
33+
34+
permissions:
35+
contents: read
36+
37+
jobs:
38+
39+
build-and-test:
40+
name: Build, Test, Release
41+
runs-on: ubuntu-latest
42+
permissions:
43+
id-token: write
44+
contents: read
45+
46+
outputs:
47+
image-tag: ${{ steps.set-image-tag.outputs.IMAGE_TAG }}
48+
49+
# it's important to specify the environment here so that GitHub knows where to get secrets from
50+
environment: ${{ inputs.env || 'dev' }}
51+
52+
# only run this workflow under very specific conditions
53+
# for example, dependabot PRs do not need to run this because GitHub prohibits dependabot PRs from accessing
54+
# any workflow which contains secrets (for security purposes)
55+
if: (inputs.env == null || inputs.env == 'dev') && github.actor != 'dependabot[bot]'
56+
steps:
57+
- name: Harden Runner
58+
uses: step-security/[email protected]
59+
with:
60+
egress-policy: audit
61+
62+
- name: Checkout Code
63+
uses: actions/checkout@v3
64+
with:
65+
token: ${{ secrets.NPM_TOKEN }}
66+

.github/workflows/container.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# ==================================================================
2+
# PUBLISH CONTAINER IMAGES (GENERIC)
3+
# ==================================================================
4+
name: Publish Container Images
5+
6+
run-name: ${{ github.actor }} initiated Publish Container Image
7+
8+
on:
9+
10+
# called by another workflow
11+
workflow_call:
12+
# triggered manually
13+
workflow_dispatch:
14+
15+
inputs:
16+
17+
image-title:
18+
description: 'Image Title'
19+
required: true
20+
type: string
21+
default: ''
22+
23+
image-description:
24+
description: 'Image Description'
25+
required: true
26+
type: string
27+
default: ''
28+
29+
image-url:
30+
description: 'Image URL'
31+
required: true
32+
type: string
33+
default: ''
34+
35+
image-source:
36+
description: 'Image Source'
37+
required: true
38+
type: string
39+
default: ''
40+
41+
# push a new version tag
42+
push:
43+
tags:
44+
- v*
45+
46+
47+
# cancel any previously started runs of this workflow on this branch
48+
concurrency:
49+
group: ${{ github.ref }}-${{ github.workflow }}
50+
cancel-in-progress: true
51+
52+
jobs:
53+
54+
multi-arch-build:
55+
name: Multi-Architecture Build
56+
runs-on: ubuntu-latest
57+
steps:
58+
59+
- name: Checkout Code
60+
uses: actions/checkout@v3
61+
62+
- name: Login to GitHub Container Registry
63+
uses: docker/login-action@v2
64+
with:
65+
registry: ghcr.io
66+
username: ${{ github.actor }}
67+
password: ${{ secrets.GITHUB_TOKEN }}
68+
69+
- name: Prepare Release Tag
70+
id: tag
71+
run: echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
72+
73+
- name: Build & Push
74+
uses: docker/build-push-action@v4
75+
with:
76+
context: .
77+
file: ./Dockerfile
78+
platforms: linux/amd64
79+
push: true
80+
labels: |
81+
org.opencontainers.image.title=${{ inputs.image-title }}
82+
org.opencontainers.image.description=${{ inputs.image-description }}
83+
org.opencontainers.image.url=${{ inputs.image-url }}
84+
org.opencontainers.image.source=${{ inputs.image-source }}
85+
org.opencontainers.image.version=${{ steps.tag.outputs.version }}
86+
tags: |
87+
ghcr.io/${{ github.actor }}/${{ inputs.image-title }}:latest
88+
ghcr.io/${{ github.actor }}/${{ inputs.image-title }}:${{ steps.tag.outputs.version }}

.github/workflows/email.yml

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# ==================================================================
2+
# SEND EMAIL REUSABLE WORKFLOW (GENERIC)
3+
# ==================================================================
4+
name: Send-Email
5+
6+
run-name: ${{ github.actor }} initiated the Send-Email workflow
7+
8+
on:
9+
10+
# triggered manually
11+
workflow_dispatch:
12+
# called by other workflows
13+
workflow_call:
14+
15+
inputs:
16+
17+
server-address:
18+
required: false
19+
type: string
20+
default: 'ragdata.dev'
21+
22+
server-port:
23+
required: false
24+
type: number
25+
default: 587
26+
27+
secure-flag:
28+
required: false
29+
type: boolean
30+
default: true
31+
32+
mail-subject:
33+
required: false
34+
type: string
35+
default: 'GitHub Actions Job Results'
36+
37+
mail-from:
38+
required: false
39+
type: string
40+
default: '"GitHub Actions" <[email protected]>'
41+
42+
mail-to:
43+
required: true
44+
type: string
45+
default: ''
46+
47+
mail-cc:
48+
required: false
49+
type: string
50+
default: ''
51+
52+
mail-bcc:
53+
required: false
54+
type: string
55+
default: ''
56+
57+
body-text:
58+
required: false
59+
type: string
60+
default: 'Build job of ${{ github.repository }} completed successfully!'
61+
62+
body-html:
63+
required: false
64+
type: string
65+
default: ''
66+
67+
ignore-cert:
68+
required: false
69+
type: boolean
70+
default: true
71+
72+
convert-markdown:
73+
required: false
74+
type: boolean
75+
default: true
76+
77+
attachment-flag:
78+
required: false
79+
type: boolean
80+
default: false
81+
82+
attachments:
83+
required: false
84+
type: string
85+
default: ''
86+
87+
priority:
88+
required: false
89+
type: string
90+
default: low
91+
92+
permissions:
93+
contents: read
94+
95+
jobs:
96+
97+
send-email:
98+
name: Send Email
99+
runs-on: ubuntu-latest
100+
steps:
101+
- name: Harden Runner
102+
uses: step-security/[email protected]
103+
with:
104+
egress-policy: audit
105+
106+
- name: Checkout Code
107+
if: inputs.attachment-flag
108+
uses: actions/checkout@v3
109+
110+
- name: Handle Attachments
111+
if: inputs.attachment-flag
112+
uses: actions/[email protected]
113+
with:
114+
name: ${{ inputs.attachments }}
115+
116+
- name: Send Email
117+
uses: dawidd6/[email protected]
118+
with:
119+
server_address: ${{ inputs.server-address }}
120+
server_port: ${{ inputs.server-port }}
121+
secure: ${{ inputs.secure-flag }}
122+
# mail server username is a secret configured at Org level
123+
username: ${{ secrets.EMAIL_USERNAME }}
124+
# mail server password is a secret configured at Org level
125+
password: ${{ secrets.EMAIL_PASSWORD }}
126+
subject: ${{ inputs.mail-subject }}
127+
to: ${{ inputs.mail-to }}
128+
from: ${{ inputs.mail-from }}
129+
cc: ${{ inputs.mail-cc }}
130+
bcc: ${{ inputs.mail-bcc }}
131+
ignore_cert: ${{ inputs.ignore-cert }}
132+
convert_markdown: ${{ inputs.convert-markdown }}
133+
attachments: ${{ inputs.attachments }}
134+
priority: ${{ inputs.priority }}

0 commit comments

Comments
 (0)