Skip to content

Commit 0b360f4

Browse files
authored
Merge pull request #4 from ComposableFi/ci
release a docker image
2 parents d034b32 + a179dc9 commit 0b360f4

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Check out the code
23+
uses: actions/checkout@v3
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v2
27+
28+
- name: Login to GitHub Container Registry
29+
uses: docker/login-action@v2
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.repository_owner }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels) for Docker (tag)
36+
id: meta-tag
37+
if: github.ref_type == 'tag'
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=semver,pattern=v{{version}}
43+
type=semver,pattern=v{{major}}.{{minor}}
44+
type=semver,pattern=v{{major}}
45+
46+
- name: Extract metadata (tags, labels) for Docker (branch)
47+
id: meta-branch
48+
if: github.ref_type == 'branch'
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
52+
tags: |
53+
type=ref,event=branch
54+
type=sha,prefix={{branch}}-{{date 'YYYYMMDDHHmmss'}}-
55+
56+
- name: Build and Push Docker Image (tag)
57+
if: github.ref_type == 'tag'
58+
uses: docker/build-push-action@v5
59+
with:
60+
context: .
61+
push: true
62+
tags: ${{ steps.meta-tag.outputs.tags }}
63+
labels: ${{ steps.meta-tag.outputs.labels }}
64+
65+
- name: Build and Push Docker Image (branch)
66+
if: github.ref_type == 'branch'
67+
uses: docker/build-push-action@v5
68+
with:
69+
context: .
70+
push: true
71+
tags: ${{ steps.meta-branch.outputs.tags }}
72+
labels: ${{ steps.meta-branch.outputs.labels }}

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Release
16+
uses: softprops/action-gh-release@v2
17+
with:
18+
generate_release_notes: true

0 commit comments

Comments
 (0)