Skip to content

Commit

Permalink
feat: use reusable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed May 17, 2023
1 parent 85425fa commit e8b155a
Show file tree
Hide file tree
Showing 16 changed files with 204 additions and 224 deletions.
12 changes: 12 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---

# https://ansible-lint.readthedocs.io/en/latest/configuring/

skip_list:
- experimental

exclude_paths:
- ./contrib
- ./.venv

...
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---

# this file is for the labeler workflow job
# Documentation https://github.com/marketplace/actions/labeler

Expand All @@ -10,3 +12,5 @@
- .dependabot/*
- .github/workflows/*
- src/**/goss.yaml.j2

...
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---

# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# file with configuration. For more information, see:
# https://github.com/actions/labeler/blob/master/README.md

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

jobs:
label:
runs-on: ubuntu-latest
steps:
- name: 🏷️ Apply labels
uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
uses: wayofdev/gh-actions/.github/workflows/apply-labels.yml@master
with:
os: ubuntu-latest
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

...
19 changes: 9 additions & 10 deletions .github/workflows/auto-merge-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ name: 🤞 Auto merge release

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

...
44 changes: 44 additions & 0 deletions .github/workflows/build-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---

on: # yamllint disable-line rule:truthy
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master

name: 🚀 Build docker images with latest tag

jobs:
# https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/expressions#example-returning-a-json-object
prepare:
runs-on: "ubuntu-latest"
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: ⚙️ Generate matrix
id: matrix
run: |
echo 'matrix={
"os_name": ["alpine"],
"node_version": ["lts", "18", "20"]
}' | tr -d '\n' >> $GITHUB_OUTPUT
build:
needs: prepare
strategy:
matrix: ${{ fromJson(needs.prepare.outputs.matrix )}}
uses: wayofdev/gh-actions/.github/workflows/build-image.yml@master
with:
os: "ubuntu-latest"
push-to-hub: ${{ github.event_name != 'pull_request' }}
image-namespace: "wayofdev/node"
image-template: ${{ matrix.node_version }}-${{ matrix.os_name }}
image-version: latest
secrets:
docker-username: ${{ secrets.DOCKER_USERNAME }}
docker-password: ${{ secrets.DOCKER_TOKEN }}

...
45 changes: 45 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---

on: # yamllint disable-line rule:truthy
release:
types:
- released

name: 🚀 Build docker images with release tag

jobs:
# https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/expressions#example-returning-a-json-object
prepare:
runs-on: "ubuntu-latest"
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: ⚙️ Generate matrix
id: matrix
run: |
echo 'matrix={
"os_name": ["alpine"],
"node_version": ["lts", "18", "20"]
}' | tr -d '\n' >> $GITHUB_OUTPUT
- name: ⚙️ Get version for image tag
id: version
run: |
echo "version=${{ github.ref_name#v }}" >> $GITHUB_OUTPUT
build:
needs: prepare
strategy:
matrix: ${{ fromJson(needs.prepare.outputs.matrix )}}
uses: wayofdev/gh-actions/.github/workflows/build-image.yml@master
with:
os: "ubuntu-latest"
push-to-hub: true
image-namespace: "wayofdev/node"
image-template: ${{ matrix.node_version }}-${{ matrix.os_name }}
image-version: ${{ needs.prepare.outputs.version }}
secrets:
docker-username: ${{ secrets.DOCKER_USERNAME }}
docker-password: ${{ secrets.DOCKER_TOKEN }}

...
120 changes: 0 additions & 120 deletions .github/workflows/ci.yml

This file was deleted.

33 changes: 8 additions & 25 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---

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

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

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: 🎉 Create release
uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
release-type: node
package-name: docker-node
default-branch: master
changelog-types: |
[
{ "type": "feat", "section": "Features", "hidden": false },
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
{ "type": "perf", "section": "Performance Improvements", "hidden": false },
{ "type": "docs", "section": "Documentation", "hidden": false },
{ "type": "chore", "section": "Miscellaneous", "hidden": false },
{ "type": "style", "section": "Styles", "hidden": true },
{ "type": "revert", "section": "Reverts", "hidden": true },
{ "type": "deps", "section": "Dependencies", "hidden": true },
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
{ "type": "test", "section": "Tests", "hidden": true },
{ "type": "build", "section": "Build System", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
]
uses: wayofdev/gh-actions/.github/workflows/create-release.yml@master
with:
os: ubuntu-latest
branch: master
package-name: docker-node
secrets:
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

...
18 changes: 6 additions & 12 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@ permissions:

jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- name: 📦 Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 🐞 Differential shell-check
uses: redhat-plumbers-in-action/differential-shellcheck@v4
with:
severity: warning
token: ${{ secrets.GITHUB_TOKEN }}
uses: wayofdev/gh-actions/.github/workflows/shellcheck.yml@master
with:
os: ubuntu-latest
severity: warning
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

...
2 changes: 0 additions & 2 deletions .github/workflows/upload-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
steps:
- name: 📦 Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 🚀 Generate dist files
run: make generate
Expand Down
Loading

0 comments on commit e8b155a

Please sign in to comment.