Skip to content

Commit 141e2ce

Browse files
committed
feat: updating workflow
1 parent a0ae999 commit 141e2ce

18 files changed

+198
-224
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/labeler.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
3+
# this file is for the labeler workflow job
4+
# Documentation https://github.com/marketplace/actions/labeler
5+
6+
"type: documentation":
7+
- assets/**/*
8+
- .github/*
9+
- ./*.md
10+
11+
"type: maintenance":
12+
- .dependabot/*
13+
- .github/workflows/*
14+
- src/**/goss.yaml.j2
15+
16+
...
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
3+
# https://github.com/peter-evans/enable-pull-request-automerge
4+
5+
on: # yamllint disable-line rule:truthy
6+
pull_request:
7+
8+
permissions:
9+
pull-requests: write
10+
contents: write
11+
12+
name: 🤞 Auto merge release
13+
14+
jobs:
15+
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@v2
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 }}
26+
27+
...

.github/workflows/ci.yml

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22

3-
name: CI
4-
53
on: # yamllint disable-line rule:truthy
64
push:
75
branches:
@@ -18,31 +16,40 @@ on: # yamllint disable-line rule:truthy
1816
# Every Tuesday at 03:10
1917
- cron: '10 3 * * 2'
2018

19+
name: 🔍 Continuous integration
20+
2121
jobs:
2222
build:
23-
name: Build
2423
runs-on: ubuntu-latest
2524
strategy:
2625
fail-fast: false
2726
matrix:
2827
rabbitmq_version: ['alpine', 'management-alpine']
2928
steps:
30-
- uses: e1himself/[email protected]
29+
- name: 📦 Install goss
30+
uses: e1himself/[email protected]
31+
32+
- name: 📦 Check out the codebase
33+
uses: actions/checkout@v3
34+
with:
35+
fetch-depth: 0
3136

32-
- name: Checkout
33-
uses: actions/[email protected]
37+
- name: 🤖 Generate dist files
38+
run: make generate
3439

35-
- name: Set Environment Variables
40+
- name: 🌎 Set environment variables
3641
env:
3742
IMAGE_NAMESPACE: wayofdev/rabbitmq
3843
TEMPLATE: ${{ matrix.rabbitmq_version }}
3944
run: |
40-
export RELEASE_VERSION=${GITHUB_REF#refs/*/}
41-
echo "IMAGE_NAMESPACE=${IMAGE_NAMESPACE}" >> $GITHUB_ENV
42-
echo "TEMPLATE=${TEMPLATE}" >> $GITHUB_ENV
43-
echo "VERSION=${RELEASE_VERSION:1}" >> $GITHUB_ENV
45+
export RELEASE_VERSION="${GITHUB_REF#refs/*/}" \
46+
&& { \
47+
echo "IMAGE_NAMESPACE=${IMAGE_NAMESPACE}"; \
48+
echo "TEMPLATE=${TEMPLATE}"; \
49+
echo "VERSION=${RELEASE_VERSION:1}"; \
50+
} >> "$GITHUB_ENV"
4451
45-
- name: Docker Meta
52+
- name: 🐳 Define docker meta
4653
id: meta
4754
uses: docker/metadata-action@v4
4855
with:
@@ -56,46 +63,50 @@ jobs:
5663
latest=false
5764
prefix=${{ matrix.rabbitmq_version }}-
5865
59-
- name: Login to DockerHub
66+
- name: 🔑 Login to docker-hub
6067
if: github.event_name != 'pull_request'
6168
uses: docker/login-action@v2
6269
with:
6370
username: ${{ secrets.DOCKER_USERNAME }}
6471
password: ${{ secrets.DOCKER_TOKEN }}
6572

6673
### For Cross Platform OSX builds uncomment these lines
67-
- name: Set up QEMU
74+
- name: 🖥️ Set up QEMU
6875
uses: docker/[email protected]
6976
with:
7077
platforms: arm64
7178

72-
- name: Set up Docker Buildx
79+
- name: 🚀 Set up Docker BuildX
7380
uses: docker/setup-buildx-action@v2
7481
with:
7582
install: true
7683

77-
- name: Build and Export to Docker
78-
uses: docker/build-push-action@v3
84+
- name: 🏷️ Set tag for docker release image
85+
if: success() && startsWith(github.ref, 'refs/tags/')
86+
run: |
87+
echo "IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-${{ env.VERSION }}" >> "$GITHUB_ENV"
88+
89+
- name: 🏷️ Set tag for docker master image
90+
if: success() && ! startsWith(github.ref, 'refs/tags/')
91+
run: |
92+
echo "IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest" >> "$GITHUB_ENV"
93+
94+
- name: 🛠️ Build and export to docker
95+
uses: docker/build-push-action@v4
7996
with:
8097
context: ./dist/${{ env.TEMPLATE }}
8198
load: true
8299
tags: ${{ steps.meta.outputs.tags }}
83-
cache-from: type=registry,ref=${{ env.IMAGE_TAG }}
100+
cache-from: type=registry,ref=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest
84101
cache-to: type=inline
85102
labels: ${{ steps.meta.outputs.labels }}
86103

87-
- name: Test Docker Release Image
88-
if: success() && startsWith(github.ref, 'refs/tags/')
89-
run: |
90-
IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-${{ env.VERSION }} make test
91-
92-
- name: Test Docker Master Image
93-
if: success() && ! startsWith(github.ref, 'refs/tags/')
104+
- name: 🧪 Test docker image
94105
run: |
95-
IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest make test
106+
export IMAGE_TAG=${{ env.IMAGE_TAG }}; make test
96107
97-
- name: Push Docker Image
98-
uses: docker/build-push-action@v3
108+
- name: 📤 Push docker image
109+
uses: docker/build-push-action@v4
99110
with:
100111
context: ./dist/${{ env.TEMPLATE }}
101112
### For Cross Platform OSX builds uncomment these lines

.github/workflows/release-please.yml renamed to .github/workflows/create-release.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ on: # yamllint disable-line rule:truthy
77
branches:
88
- master
99

10-
name: release-please
10+
name: 📦 Create release
1111

1212
jobs:
13-
release-please:
13+
release:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: google-github-actions/release-please-action@v3
16+
- name: 🎉 Create release
17+
uses: google-github-actions/release-please-action@v3
1718
id: release
1819
with:
1920
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

.github/workflows/label.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
3+
# This workflow will triage pull requests and apply a label based on the
4+
# paths that are modified in the pull request.
5+
#
6+
# To use this workflow, you will need to set up a .github/labeler.yml
7+
# file with configuration. For more information, see:
8+
# https://github.com/actions/labeler/blob/master/README.md
9+
10+
on: # yamllint disable-line rule:truthy
11+
pull_request:
12+
13+
name: 🏷️ Add labels
14+
15+
jobs:
16+
label:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: 🏷️ Apply labels
20+
uses: actions/labeler@v4
21+
with:
22+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
23+
24+
...

.github/workflows/shellcheck.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
---
22

3-
name: Differential ShellCheck
4-
53
on: # yamllint disable-line rule:truthy
64
pull_request:
75

6+
name: 🐞 Differential shell-check
7+
88
permissions:
99
contents: read
1010

1111
jobs:
1212
shellcheck:
1313
runs-on: ubuntu-latest
14-
1514
steps:
16-
- name: Repository checkout
17-
uses: actions/checkout@v3.2.0
15+
- name: 📦 Check out the codebase
16+
uses: actions/checkout@v3
1817
with:
1918
fetch-depth: 0
2019

21-
- name: Differential ShellCheck
22-
uses: redhat-plumbers-in-action/differential-shellcheck@v3
20+
- name: 🐞 Differential shell-check
21+
uses: redhat-plumbers-in-action/differential-shellcheck@v4
2322
with:
2423
severity: warning
2524
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/upload-assets.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
3+
# https://github.com/google-github-actions/release-please-action#release-types-supported
4+
5+
on: # yamllint disable-line rule:truthy
6+
push:
7+
tags:
8+
- "v*.*.*"
9+
10+
name: 📤 Upload artifacts
11+
12+
jobs:
13+
upload-artifacts:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: 📦 Check out the codebase
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: 🚀 Generate dist files
22+
run: make generate
23+
24+
- name: 🗜️ Archive dist files
25+
run: tar -czvf dist.tar.gz dist
26+
27+
- name: 📤 Upload release assets
28+
uses: alexellis/[email protected]
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
with:
32+
asset_paths: '["./dist.tar.gz"]'
33+
34+
...

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.idea
2+
/dist

.pre-commit-config.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22

33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.3.0
5+
rev: v4.4.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: fix-encoding-pragma
1010

1111
- repo: https://github.com/commitizen-tools/commitizen
12-
rev: v2.37.0
12+
rev: v2.42.1
1313
hooks:
1414
- id: commitizen
1515
stages:
1616
- commit-msg
1717

18+
- repo: https://github.com/rhysd/actionlint
19+
rev: v1.6.23
20+
hooks:
21+
- id: actionlint
22+
1823
...

0 commit comments

Comments
 (0)