chore: cleanup actions and allow reuse + pr template (#1637)

* cleanup actions and allow reuse

* add PR template
This commit is contained in:
Hayden 2022-09-10 10:58:02 -08:00 committed by GitHub
parent 2df791b80b
commit e989651336
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 226 additions and 216 deletions

72
.github/pull_request_template.md vendored Normal file
View file

@ -0,0 +1,72 @@
<!--
This template provides some ideas of things to include in your PR description.
To start, try providing a short summary of your changes in the Title above.
If a section of the PR template does not apply to this PR, then delete that section.
-->
## What type of PR is this?
_(REQUIRED)_
<!--
Delete any of the following that do not apply:
-->
- bug
- cleanup
- documentation
- feature
## What this PR does / why we need it:
_(REQUIRED)_
<!--
What goal is this change working towards?
Provide a bullet pointed summary of how each file was changed.
Briefly explain any decisions you made with respect to the changes.
Include anything here that you didn't include in *Release Notes*
above, such as changes to CI or changes to internal methods.
-->
## Which issue(s) this PR fixes:
_(REQUIRED)_
<!--
If this PR fixes one of more issues, list them here.
One line each, like so:
Fixes #123
Fixes #39
-->
## Special notes for your reviewer:
_(fill-in or delete this section)_
<!--
Is there any particular feedback you would / wouldn't like?
Which parts of the code should reviewers focus on?
-->
## Testing
_(fill-in or delete this section)_
<!--
Describe how you tested this change.
-->
## Release Notes
_(REQUIRED)_
<!--
If this PR makes user facing changes, please describe them here. This
description will be copied into the release notes/changelog, whenever the
next version is released. Keep this section short, and focus on high level
changes.
Put your text between the block. To omit notes, use NONE within the block.
-->
```release-note
```

View file

@ -1,63 +0,0 @@
name: Backend - Nightly Build
on:
push:
branches:
- mealie-next
concurrency:
group: backend-nightly-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
#
# Checkout
#
- name: checkout code
uses: actions/checkout@v2
#
# Setup QEMU
#
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
#
# Setup Buildx
#
- name: install buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
#
# Login to Docker Hub
#
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# Build
#
- name: build the image
run: |
docker build --push --no-cache \
--tag hkotel/mealie:api-nightly \
--build-arg COMMIT=$(git rev-parse HEAD) \
--platform linux/amd64,linux/arm64 .
#
# Build Discord Notification
#
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_NIGHTLY_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: "🚀 A New build of mealie:api-nightly is available"

View file

@ -1,75 +0,0 @@
name: Docker Build Production
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
#
# Get Release Version
#
- uses: oprypin/find-latest-tag@v1
with:
repository: hay-kot/mealie # The repository to scan.
releases-only: true # We know that all relevant tags have a GitHub release for them.
id: mealie_version # The step ID to refer to later.
#
# Checkout
#
- name: checkout code
uses: actions/checkout@v2
#
# Setup QEMU
#
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
#
# Setup Buildx
#
- name: install buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
#
# Login to Docker Hub
#
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# Build Backend
#
- name: build the image
run: |
docker build --push --no-cache \
--tag hkotel/mealie:api-${{ steps.mealie_version.outputs.tag }} \
--build-arg COMMIT=$(git rev-parse HEAD) \
--platform linux/amd64,linux/arm64 .
#
# Build Frontend
#
- name: build the image
working-directory: "frontend"
run: |
docker build --push --no-cache \
--tag hkotel/mealie:frontend-${{ steps.mealie_version.outputs.tag }} \
--platform linux/amd64,linux/arm64 .
#
# Release Discord Notification
#
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: '🚀 Version {{ EVENT_PAYLOAD.release.tag_name }} of Mealie has been released. See the release notes https://github.com/hay-kot/mealie/releases/tag/{{ EVENT_PAYLOAD.release.tag_name }}'

View file

@ -1,63 +0,0 @@
name: Frontend - Nightly Build
on:
push:
branches:
- mealie-next
concurrency:
group: frontend-nightly-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
#
# Checkout
#
- name: checkout code
uses: actions/checkout@v2
#
# Setup QEMU
#
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
#
# Setup Buildx
#
- name: install buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
#
# Login to Docker Hub
#
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# Build
#
- name: build the image
working-directory: "frontend"
run: |
docker build --push --no-cache \
--tag hkotel/mealie:frontend-nightly \
--platform linux/amd64,linux/arm64 .
#
# Build Discord Notification
#
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_NIGHTLY_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: "🚀 A New build of mealie:frontend-nightly is available"

37
.github/workflows/nightly.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: Docker Nightly Production
on:
push:
branches:
- mealie-next
jobs:
backend-tests:
name: "Backend Server Tests"
uses: hay-kot/mealie/.github/workflows/partial-backend.yml@mealie-next
frontend-tests:
name: "Frontend and End-to-End Tests"
uses: hay-kot/mealie/.github/workflows/partial-frontend.yml@mealie-next
build-release:
name: Build Tagged Release
uses: hay-kot/mealie/.github/workflows/partial-builder.yml@mealie-next
needs:
- frontend-tests
- backend-tests
with:
tag: nightly
notify-discord:
name: Notify Discord
needs:
- build-release
runs-on: ubuntu-latest
steps:
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_NIGHTLY_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: "🚀 A New build of mealie:api-nightly and mealie:frontend-nightly is available"

View file

@ -1,12 +1,8 @@
name: Backend Tests
name: Backend Test/Lint
on:
push:
branches:
- mealie-next
pull_request:
branches:
- mealie-next
types: [synchronize, opened, reopened, ready_for_review]
workflow_call:
jobs:
tests:

48
.github/workflows/partial-builder.yml vendored Normal file
View file

@ -0,0 +1,48 @@
name: Build Containers
on:
workflow_call:
inputs:
tag:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Backend Image
run: |
docker build --push --no-cache \
--tag hkotel/mealie:api-${{ inputs.tag }} \
--build-arg COMMIT=$(git rev-parse HEAD) \
--platform linux/amd64,linux/arm64 .
- name: Build Frontend Image
working-directory: "frontend"
run: |
docker build --push --no-cache \
--tag hkotel/mealie:frontend-${{ inputs.tag }} \
--platform linux/amd64,linux/arm64 .

View file

@ -1,12 +1,7 @@
name: Frontend Lint
name: Frontend Build/Lin
on:
push:
branches:
- mealie-next
pull_request:
branches:
- mealie-next
workflow_call:
jobs:
lint:

15
.github/workflows/pull-requests.yml vendored Normal file
View file

@ -0,0 +1,15 @@
name: PR CI
on:
pull_request:
branches:
- mealie-next
jobs:
backend-tests:
name: "Backend Server Tests"
uses: hay-kot/mealie/.github/workflows/partial-backend.yml@mealie-next
frontend-tests:
name: "Frontend and End-to-End Tests"
uses: hay-kot/mealie/.github/workflows/partial-frontend.yml@mealie-next

48
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,48 @@
name: Docker Build Production
on:
release:
types: [published]
jobs:
backend-tests:
name: "Backend Server Tests"
uses: hay-kot/mealie/.github/workflows/partial-backend.yml@mealie-next
frontend-tests:
name: "Frontend and End-to-End Tests"
uses: hay-kot/mealie/.github/workflows/partial-frontend.yml@mealie-next
get-release:
name: "Get Releave Tag"
runs-on: ubuntu-latest
needs:
- backend-tests
- frontend-tests
outputs:
tag: ${{ steps.get-tag.outputs.tag }}
steps:
- uses: oprypin/find-latest-tag@v1
with:
repository: hay-kot/mealie # The repository to scan.
releases-only: true # We know that all relevant tags have a GitHub release for them.
build-release:
name: Build Tagged Release
uses: hay-kot/mealie/.github/workflows/partial-builder.yml@mealie-next
needs:
- get-release
with:
tag: ${{ jobs.get-release.outputs.tag }}
notify-discord:
name: Notify Discord
needs:
- build-release
runs-on: ubuntu-latest
steps:
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: "🚀 Version {{ EVENT_PAYLOAD.release.tag_name }} of Mealie has been released. See the release notes https://github.com/hay-kot/mealie/releases/tag/{{ EVENT_PAYLOAD.release.tag_name }}"