Skip to content

Commit 189af69

Browse files
committed
tech(#3): adding a build workflows and a codeowners file
1 parent 7471a59 commit 189af69

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @enzodjabali

.github/workflows/build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and Publish to GitHub Packages on Tag
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Matches any tag; adjust for specific patterns like 'v*'
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
# Step 1: Checkout the code
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
# Step 2: Log in to GitHub Packages container registry
21+
- name: Log in to GitHub Container Registry
22+
uses: docker/login-action@v2
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
# Step 3: Build and tag the Docker image with version tag and 'latest'
29+
- name: Build and tag Docker image
30+
run: |
31+
TAG=$(echo ${GITHUB_REF#refs/tags/}) # Extract the tag
32+
IMAGE=ghcr.io/enzodjabali/iosmb-router
33+
docker build --build-arg VERSION=$TAG -t $IMAGE:$TAG .
34+
docker tag $IMAGE:$TAG $IMAGE:latest
35+
36+
# Step 4: Push the Docker image with version tag
37+
- name: Push Docker image with version tag
38+
run: |
39+
TAG=$(echo ${GITHUB_REF#refs/tags/}) # Extract the tag
40+
IMAGE=ghcr.io/enzodjabali/iosmb-router
41+
docker push $IMAGE:$TAG
42+
43+
# Step 5: Push the Docker image with 'latest' tag
44+
- name: Push Docker image with 'latest' tag
45+
run: |
46+
IMAGE=ghcr.io/enzodjabali/iosmb-router
47+
docker push $IMAGE:latest

0 commit comments

Comments
 (0)