Skip to content

Commit

Permalink
feat: reusable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed May 17, 2023
1 parent b99a1db commit 50cdecc
Show file tree
Hide file tree
Showing 21 changed files with 438 additions and 287 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

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

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

"type: documentation":
- assets/**/*
- .github/*
- ./*.md

"type: maintenance":
- .github/workflows/*

...
23 changes: 23 additions & 0 deletions .github/workflows/apply-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---

# 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:
# https://github.com/actions/labeler/blob/master/README.md

on: # yamllint disable-line rule:truthy
pull_request:

name: 🏷️ Add labels

jobs:
label:
uses: wayofdev/gh-actions/.github/workflows/apply-labels.yml@master
with:
os: ubuntu-latest
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

...
26 changes: 26 additions & 0 deletions .github/workflows/auto-merge-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---

# https://github.com/peter-evans/enable-pull-request-automerge

on: # yamllint disable-line rule:truthy
pull_request:

permissions:
pull-requests: write
contents: write

name: 🤞 Auto merge release

jobs:
auto-merge:
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 }}

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

on: # yamllint disable-line rule:truthy
workflow_dispatch:
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"],
"php_version": ["8.1", "8.2"],
"php_type": ["fpm", "cli", "supervisord"]
}' | 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: true
image-namespace: "wayofdev/php-dev"
image-template-path: "./dist/dev"
image-template: ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}
image-version: latest
secrets:
docker-username: ${{ secrets.DOCKER_USERNAME }}
docker-password: ${{ secrets.DOCKER_TOKEN }}

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

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 }}
version: ${{ steps.version.outputs.version }}
steps:
- name: ⚙️ Generate matrix
id: matrix
run: |
echo 'matrix={
"os_name": ["alpine"],
"php_version": ["8.1", "8.2"],
"php_type": ["fpm", "cli", "supervisord"]
}' | tr -d '\n' >> $GITHUB_OUTPUT
- name: ⚙️ Get version for image tag
id: version
run: |
version=${{ github.ref_name }}
version=${version#v}
echo "version=$version" >> $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/php-dev"
image-template-path: "./dist/dev"
image-template: ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}
image-version: ${{ needs.prepare.outputs.version }}
secrets:
docker-username: ${{ secrets.DOCKER_USERNAME }}
docker-password: ${{ secrets.DOCKER_TOKEN }}

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

This file was deleted.

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

# 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
push:
branches:
- master

name: 📦 Create release

jobs:
release:
uses: wayofdev/gh-actions/.github/workflows/create-release.yml@master
with:
os: ubuntu-latest
branch: master
package-name: docker-php-dev
secrets:
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

...
39 changes: 0 additions & 39 deletions .github/workflows/release-please.yml

This file was deleted.

23 changes: 8 additions & 15 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
---

name: Differential ShellCheck

on: # yamllint disable-line rule:truthy
pull_request:

name: 🐞 Differential shell-check

permissions:
contents: read

jobs:
shellcheck:
runs-on: ubuntu-latest

steps:
- name: Repository checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Differential ShellCheck
uses: redhat-plumbers-in-action/differential-shellcheck@v3
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 }}

...
Loading

0 comments on commit 50cdecc

Please sign in to comment.