Skip to content

Commit c0b85b3

Browse files
committed
add workflows and templates
1 parent 1311542 commit c0b85b3

File tree

4 files changed

+253
-0
lines changed

4 files changed

+253
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'bug :bug:'
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: 'enhancement :rocket:'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Build and push image to registry
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
image_name:
7+
description: A list of the repo names to push to
8+
required: true
9+
type: string
10+
region:
11+
description: The AWS region to use for the ECR registry
12+
required: true
13+
type: string
14+
tags:
15+
# https://github.com/marketplace/actions/docker-metadata-action#tags-input
16+
description: Tag rules for docker/metadata-action
17+
required: false
18+
type: string
19+
default: |
20+
type=edge
21+
type=semver,pattern={{version}}
22+
type=semver,pattern={{major}}.{{minor}}
23+
type=semver,pattern={{major}}
24+
context:
25+
description: The context to use for the Docker build command
26+
required: false
27+
type: string
28+
default: ./
29+
dockerfile:
30+
description: The Dockerfile to use for the Docker build command
31+
required: false
32+
type: string
33+
default: Dockerfile
34+
platforms:
35+
description: The platforms to use for the Docker build command
36+
required: false
37+
type: string
38+
default: linux/amd64
39+
push:
40+
description: Whether to push the image to the registry
41+
required: false
42+
type: boolean
43+
default: true
44+
45+
secrets:
46+
role_to_assume:
47+
required: true
48+
49+
jobs:
50+
build:
51+
name: Build and push image to registry
52+
runs-on: ubuntu-latest
53+
54+
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
55+
permissions:
56+
id-token: write
57+
contents: read
58+
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v4
62+
63+
- name: Configure AWS Credentials
64+
uses: aws-actions/configure-aws-credentials@v4
65+
with:
66+
role-to-assume: ${{ secrets.role_to_assume }}
67+
aws-region: ${{ inputs.region }}
68+
69+
- name: Login to Amazon ECR
70+
id: login-ecr
71+
uses: aws-actions/amazon-ecr-login@v2
72+
73+
- name: Docker meta
74+
id: meta
75+
uses: docker/metadata-action@v5
76+
with:
77+
images: ${{ steps.login-ecr.outputs.registry }}/${{ inputs.image_name }}
78+
tags: ${{ inputs.tags }}
79+
80+
- name: Set up Docker Buildx
81+
id: buildx
82+
uses: docker/setup-buildx-action@v3
83+
84+
- name: Build and push
85+
uses: docker/build-push-action@v5
86+
with:
87+
builder: ${{ steps.buildx.outputs.name }}
88+
context: ${{ inputs.context }}
89+
file: ${{ inputs.dockerfile }}
90+
platforms: ${{ inputs.platforms }}
91+
push: ${{ inputs.push }}
92+
tags: ${{ steps.meta.outputs.tags }}
93+
labels: ${{ steps.meta.outputs.labels }}
94+
cache-from: type=gha
95+
cache-to: type=gha,mode=max
96+
build-args: |
97+
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
98+
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Build and push image to registry
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
registry:
7+
description: Registry to push to, defaults to Docker Hub
8+
required: false
9+
type: string
10+
images:
11+
description: A list of the org/repo names to push to
12+
required: true
13+
type: string
14+
tags:
15+
# https://github.com/marketplace/actions/docker-metadata-action#tags-input
16+
description: Tag rules for docker/metadata-action
17+
required: false
18+
type: string
19+
default: |
20+
type=edge
21+
type=semver,pattern={{version}}
22+
type=semver,pattern={{major}}.{{minor}}
23+
type=semver,pattern={{major}}
24+
context:
25+
description: The context to use for the Docker build command
26+
required: false
27+
type: string
28+
default: ./
29+
dockerfile:
30+
description: The Dockerfile to use for the Docker build command
31+
required: false
32+
type: string
33+
default: Dockerfile
34+
platforms:
35+
description: The platforms to use for the Docker build command
36+
required: false
37+
type: string
38+
default: linux/amd64
39+
push:
40+
description: Whether to push the image to the registry
41+
required: false
42+
type: boolean
43+
default: true
44+
45+
secrets:
46+
username:
47+
required: true
48+
token:
49+
required: true
50+
51+
jobs:
52+
build:
53+
name: Build and push image to registry
54+
runs-on: ubuntu-latest
55+
56+
permissions:
57+
contents: read
58+
packages: write # needed when pushing image to ghcr.io
59+
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
64+
- name: Docker meta
65+
id: meta
66+
uses: docker/metadata-action@v5
67+
with:
68+
images: ${{ inputs.images }}
69+
tags: ${{ inputs.tags }}
70+
71+
- name: Set up Docker Buildx
72+
id: buildx
73+
uses: docker/setup-buildx-action@v3
74+
75+
- name: Login to the container registry
76+
if: ${{ inputs.push }}
77+
uses: docker/login-action@v3
78+
with:
79+
registry: ${{ inputs.registry }}
80+
username: ${{ secrets.username }}
81+
password: ${{ secrets.token }}
82+
83+
- name: Build and push
84+
uses: docker/build-push-action@v5
85+
with:
86+
builder: ${{ steps.buildx.outputs.name }}
87+
context: ${{ inputs.context }}
88+
file: ${{ inputs.dockerfile }}
89+
platforms: ${{ inputs.platforms }}
90+
push: ${{ inputs.push }}
91+
tags: ${{ steps.meta.outputs.tags }}
92+
labels: ${{ steps.meta.outputs.labels }}
93+
cache-from: type=gha
94+
cache-to: type=gha,mode=max
95+
build-args: |
96+
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
97+
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}

0 commit comments

Comments
 (0)