Skip to content

Commit 7ca8a62

Browse files
authored
Merge pull request #64 from wayofdev/feat/reusable-workflows
2 parents 85425fa + 5d5ea99 commit 7ca8a62

18 files changed

+209
-227
lines changed

.ansible-lint

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
3+
# https://ansible-lint.readthedocs.io/en/latest/configuring/
4+
5+
skip_list:
6+
- experimental
7+
8+
exclude_paths:
9+
- ./contrib
10+
- ./.venv
11+
12+
...

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
# this file is for the labeler workflow job
24
# Documentation https://github.com/marketplace/actions/labeler
35

@@ -10,3 +12,5 @@
1012
- .dependabot/*
1113
- .github/workflows/*
1214
- src/**/goss.yaml.j2
15+
16+
...
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
---
2+
13
# This workflow will triage pull requests and apply a label based on the
24
# paths that are modified in the pull request.
35
#
46
# To use this workflow, you will need to set up a .github/labeler.yml
5-
# file with configuration. For more information, see:
7+
# file with configuration. For more information, see:
68
# https://github.com/actions/labeler/blob/master/README.md
79

810
on: # yamllint disable-line rule:truthy
@@ -12,11 +14,10 @@ name: 🏷️ Add labels
1214

1315
jobs:
1416
label:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: 🏷️ Apply labels
18-
uses: actions/labeler@v4
19-
with:
20-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
17+
uses: wayofdev/gh-actions/.github/workflows/apply-labels.yml@master
18+
with:
19+
os: ubuntu-latest
20+
secrets:
21+
token: ${{ secrets.GITHUB_TOKEN }}
2122

2223
...

.github/workflows/auto-merge-release.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ name: 🤞 Auto merge release
1313

1414
jobs:
1515
auto-merge:
16-
if: github.actor == 'lotyp' && startsWith(github.head_ref, 'release-please--')
17-
runs-on: ubuntu-latest
18-
steps:
19-
- name: 🤞 Auto-merge pull request
20-
uses: peter-evans/enable-pull-request-automerge@v3
21-
with:
22-
pull-request-number: ${{ github.event.pull_request.number }}
23-
merge-method: merge
24-
# to trigger other workflows, pass PAT token instead of GITHUB_TOKEN
25-
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
16+
uses: wayofdev/gh-actions/.github/workflows/auto-merge-release.yml@master
17+
with:
18+
os: ubuntu-latest
19+
pull-request-number: ${{ github.event.pull_request.number }}
20+
actor: lotyp
21+
merge-method: merge
22+
secrets:
23+
# to trigger other workflows, pass PAT token instead of GITHUB_TOKEN
24+
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
2625

2726
...

.github/workflows/build-latest.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
branches:
10+
- master
11+
12+
name: 🚀 Build docker images with latest tag
13+
14+
jobs:
15+
# https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/expressions#example-returning-a-json-object
16+
prepare:
17+
runs-on: "ubuntu-latest"
18+
outputs:
19+
matrix: ${{ steps.matrix.outputs.matrix }}
20+
steps:
21+
- name: ⚙️ Generate matrix
22+
id: matrix
23+
run: |
24+
echo 'matrix={
25+
"os_name": ["alpine"],
26+
"node_version": ["lts", "18", "20"]
27+
}' | tr -d '\n' >> $GITHUB_OUTPUT
28+
29+
build:
30+
needs: prepare
31+
strategy:
32+
matrix: ${{ fromJson(needs.prepare.outputs.matrix )}}
33+
uses: wayofdev/gh-actions/.github/workflows/build-image.yml@master
34+
with:
35+
os: "ubuntu-latest"
36+
push-to-hub: true
37+
image-namespace: "wayofdev/node"
38+
image-template-path: "./dist"
39+
image-template: ${{ matrix.node_version }}-${{ matrix.os_name }}
40+
image-version: latest
41+
secrets:
42+
docker-username: ${{ secrets.DOCKER_USERNAME }}
43+
docker-password: ${{ secrets.DOCKER_TOKEN }}
44+
45+
...
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
4+
release:
5+
types:
6+
- released
7+
8+
name: 🚀 Build docker images with release tag
9+
10+
jobs:
11+
# https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/expressions#example-returning-a-json-object
12+
prepare:
13+
runs-on: "ubuntu-latest"
14+
outputs:
15+
matrix: ${{ steps.matrix.outputs.matrix }}
16+
steps:
17+
- name: ⚙️ Generate matrix
18+
id: matrix
19+
run: |
20+
echo 'matrix={
21+
"os_name": ["alpine"],
22+
"node_version": ["lts", "18", "20"]
23+
}' | tr -d '\n' >> $GITHUB_OUTPUT
24+
25+
- name: ⚙️ Get version for image tag
26+
id: version
27+
run: |
28+
echo "version=${{ github.ref_name#v }}" >> $GITHUB_OUTPUT
29+
30+
build:
31+
needs: prepare
32+
strategy:
33+
matrix: ${{ fromJson(needs.prepare.outputs.matrix )}}
34+
uses: wayofdev/gh-actions/.github/workflows/build-image.yml@master
35+
with:
36+
os: "ubuntu-latest"
37+
push-to-hub: true
38+
image-namespace: "wayofdev/node"
39+
image-template-path: "./dist"
40+
image-template: ${{ matrix.node_version }}-${{ matrix.os_name }}
41+
image-version: ${{ needs.prepare.outputs.version }}
42+
secrets:
43+
docker-username: ${{ secrets.DOCKER_USERNAME }}
44+
docker-password: ${{ secrets.DOCKER_TOKEN }}
45+
46+
...

.github/workflows/ci.yml

Lines changed: 0 additions & 120 deletions
This file was deleted.
Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22

3+
# https://github.com/wayofdev/gh-actions/blob/master/.github/workflows/create-release.yml
34
# https://github.com/google-github-actions/release-please-action#release-types-supported
45

56
on: # yamllint disable-line rule:truthy
@@ -11,30 +12,12 @@ name: 📦 Create release
1112

1213
jobs:
1314
release:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- name: 🎉 Create release
17-
uses: google-github-actions/release-please-action@v3
18-
id: release
19-
with:
20-
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
21-
release-type: node
22-
package-name: docker-node
23-
default-branch: master
24-
changelog-types: |
25-
[
26-
{ "type": "feat", "section": "Features", "hidden": false },
27-
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
28-
{ "type": "perf", "section": "Performance Improvements", "hidden": false },
29-
{ "type": "docs", "section": "Documentation", "hidden": false },
30-
{ "type": "chore", "section": "Miscellaneous", "hidden": false },
31-
{ "type": "style", "section": "Styles", "hidden": true },
32-
{ "type": "revert", "section": "Reverts", "hidden": true },
33-
{ "type": "deps", "section": "Dependencies", "hidden": true },
34-
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
35-
{ "type": "test", "section": "Tests", "hidden": true },
36-
{ "type": "build", "section": "Build System", "hidden": true },
37-
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
38-
]
15+
uses: wayofdev/gh-actions/.github/workflows/create-release.yml@master
16+
with:
17+
os: ubuntu-latest
18+
branch: master
19+
package-name: docker-node
20+
secrets:
21+
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
3922

4023
...

.github/workflows/shellcheck.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,11 @@ permissions:
1010

1111
jobs:
1212
shellcheck:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: 📦 Check out the codebase
16-
uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
19-
20-
- name: 🐞 Differential shell-check
21-
uses: redhat-plumbers-in-action/differential-shellcheck@v4
22-
with:
23-
severity: warning
24-
token: ${{ secrets.GITHUB_TOKEN }}
13+
uses: wayofdev/gh-actions/.github/workflows/shellcheck.yml@master
14+
with:
15+
os: ubuntu-latest
16+
severity: warning
17+
secrets:
18+
token: ${{ secrets.GITHUB_TOKEN }}
2519

2620
...

.github/workflows/upload-assets.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ jobs:
1515
steps:
1616
- name: 📦 Check out the codebase
1717
uses: actions/checkout@v3
18-
with:
19-
fetch-depth: 0
2018

2119
- name: 🚀 Generate dist files
2220
run: make generate

0 commit comments

Comments
 (0)