Skip to content

feat: updating workflow #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .github/dependabot.yml

This file was deleted.

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

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

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

"type: maintenance":
- .dependabot/*
- .github/workflows/*
- src/**/goss.yaml.j2

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

# 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:
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@v2
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 }}

...
67 changes: 39 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---

name: CI

on: # yamllint disable-line rule:truthy
push:
branches:
Expand All @@ -18,31 +16,40 @@ on: # yamllint disable-line rule:truthy
# Every Tuesday at 03:10
- cron: '10 3 * * 2'

name: 🔍 Continuous integration

jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rabbitmq_version: ['alpine', 'management-alpine']
steps:
- uses: e1himself/[email protected]
- name: 📦 Install goss
uses: e1himself/[email protected]

- name: 📦 Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Checkout
uses: actions/[email protected]
- name: 🤖 Generate dist files
run: make generate

- name: Set Environment Variables
- name: 🌎 Set environment variables
env:
IMAGE_NAMESPACE: wayofdev/rabbitmq
TEMPLATE: ${{ matrix.rabbitmq_version }}
run: |
export RELEASE_VERSION=${GITHUB_REF#refs/*/}
echo "IMAGE_NAMESPACE=${IMAGE_NAMESPACE}" >> $GITHUB_ENV
echo "TEMPLATE=${TEMPLATE}" >> $GITHUB_ENV
echo "VERSION=${RELEASE_VERSION:1}" >> $GITHUB_ENV
export RELEASE_VERSION="${GITHUB_REF#refs/*/}" \
&& { \
echo "IMAGE_NAMESPACE=${IMAGE_NAMESPACE}"; \
echo "TEMPLATE=${TEMPLATE}"; \
echo "VERSION=${RELEASE_VERSION:1}"; \
} >> "$GITHUB_ENV"

- name: Docker Meta
- name: 🐳 Define docker meta
id: meta
uses: docker/metadata-action@v4
with:
Expand All @@ -56,46 +63,50 @@ jobs:
latest=false
prefix=${{ matrix.rabbitmq_version }}-

- name: Login to DockerHub
- name: 🔑 Login to docker-hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

### For Cross Platform OSX builds uncomment these lines
- name: Set up QEMU
- name: 🖥️ Set up QEMU
uses: docker/[email protected]
with:
platforms: arm64

- name: Set up Docker Buildx
- name: 🚀 Set up Docker BuildX
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Build and Export to Docker
uses: docker/build-push-action@v3
- name: 🏷️ Set tag for docker release image
if: success() && startsWith(github.ref, 'refs/tags/')
run: |
echo "IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-${{ env.VERSION }}" >> "$GITHUB_ENV"

- name: 🏷️ Set tag for docker master image
if: success() && ! startsWith(github.ref, 'refs/tags/')
run: |
echo "IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest" >> "$GITHUB_ENV"

- name: 🛠️ Build and export to docker
uses: docker/build-push-action@v4
with:
context: ./dist/${{ env.TEMPLATE }}
load: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ env.IMAGE_TAG }}
cache-from: type=registry,ref=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest
cache-to: type=inline
labels: ${{ steps.meta.outputs.labels }}

- name: Test Docker Release Image
if: success() && startsWith(github.ref, 'refs/tags/')
run: |
IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-${{ env.VERSION }} make test

- name: Test Docker Master Image
if: success() && ! startsWith(github.ref, 'refs/tags/')
- name: 🧪 Test docker image
run: |
IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest make test
export IMAGE_TAG=${{ env.IMAGE_TAG }}; make test

- name: Push Docker Image
uses: docker/build-push-action@v3
- name: 📤 Push docker image
uses: docker/build-push-action@v4
with:
context: ./dist/${{ env.TEMPLATE }}
### For Cross Platform OSX builds uncomment these lines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ on: # yamllint disable-line rule:truthy
branches:
- master

name: release-please
name: 📦 Create release

jobs:
release-please:
release:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
- name: 🎉 Create release
uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---

# 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:
runs-on: ubuntu-latest
steps:
- name: 🏷️ Apply labels
uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

...
13 changes: 6 additions & 7 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
---

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/checkout@v3.2.0
- name: 📦 Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Differential ShellCheck
uses: redhat-plumbers-in-action/differential-shellcheck@v3
- name: 🐞 Differential shell-check
uses: redhat-plumbers-in-action/differential-shellcheck@v4
with:
severity: warning
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/upload-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---

# https://github.com/google-github-actions/release-please-action#release-types-supported

on: # yamllint disable-line rule:truthy
push:
tags:
- "v*.*.*"

name: 📤 Upload artifacts

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

- name: 🚀 Generate dist files
run: make generate

- name: 🗜️ Archive dist files
run: tar -czvf dist.tar.gz dist

- name: 📤 Upload release assets
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_paths: '["./dist.tar.gz"]'

...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
/dist
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: fix-encoding-pragma

- repo: https://github.com/commitizen-tools/commitizen
rev: v2.37.0
rev: v2.42.1
hooks:
- id: commitizen
stages:
- commit-msg

- repo: https://github.com/rhysd/actionlint
rev: v1.6.23
hooks:
- id: actionlint

...
Loading