Skip to content

Commit

Permalink
experiment with central Makefile and extended calver workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JaSei committed Oct 27, 2023
1 parent 5bf8828 commit 515baef
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 21 additions & 0 deletions Makefile.inc
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)
6 changes: 6 additions & 0 deletions services/a/Dockerfile
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"]
3 changes: 3 additions & 0 deletions services/a/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SERVICE_NAME = $(shell basename $(shell pwd))

include ../../Makefile.inc
9 changes: 9 additions & 0 deletions services/a/service.sh
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

0 comments on commit 515baef

Please sign in to comment.