-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experiment with central Makefile and extended calver workflow
- Loading branch information
Showing
5 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,17 @@ jobs: | |
|
||
- name: Run service ${{ inputs.service_name }} test script | ||
run: ./test.sh | ||
|
||
- name: Get next version | ||
uses: reecetech/[email protected] | ||
id: version | ||
with: | ||
scheme: calver | ||
|
||
- name: Build docker image | ||
run: make build | ||
|
||
- name: Release docker image | ||
env: | ||
VERSION: ${{ steps.version.outputs.version }} | ||
run: make release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.PHONY: test build release | ||
|
||
ifndef SERVICE_NAME | ||
$(error SERVICE_NAME is not set) | ||
endif | ||
|
||
ifndef VERSION | ||
$(error VERSION is not set) | ||
endif | ||
|
||
# Make sure there are no spaces. | ||
SERVICE_NAME := $(SERVICE_NAME: =_) | ||
|
||
test: | ||
./test.sh | ||
|
||
build: | ||
docker build -t $(SERVICE_NAME) . | ||
|
||
release: | ||
docker tag $(SERVICE_NAME) $(SERVICE_NAME):$(VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM debian:12-slim | ||
|
||
COPY ./service.sh /service.sh | ||
RUN chmod +x /service.sh | ||
|
||
ENTRYPOINT ["/service.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SERVICE_NAME = $(shell basename $(shell pwd)) | ||
|
||
include ../../Makefile.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
counter=1 | ||
|
||
while true; do | ||
echo "Service '$SERVICE_NAME': $counter" | ||
((counter++)) | ||
sleep 1 | ||
done |