mirror of
https://github.com/fosrl/olm.git
synced 2026-02-08 05:56:41 +00:00
29
.github/workflows/cicd.yml
vendored
29
.github/workflows/cicd.yml
vendored
@@ -17,12 +17,6 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract tag name
|
- name: Extract tag name
|
||||||
id: get-tag
|
id: get-tag
|
||||||
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||||
@@ -32,20 +26,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: 1.23.1
|
go-version: 1.23.1
|
||||||
|
|
||||||
- name: Update version in main.go
|
# - name: Update version in main.go
|
||||||
run: |
|
# run: |
|
||||||
TAG=${{ env.TAG }}
|
# TAG=${{ env.TAG }}
|
||||||
if [ -f main.go ]; then
|
# if [ -f main.go ]; then
|
||||||
sed -i 's/Olm version replaceme/Olm version '"$TAG"'/' main.go
|
# sed -i 's/Olm version replaceme/Olm version '"$TAG"'/' main.go
|
||||||
echo "Updated main.go with version $TAG"
|
# echo "Updated main.go with version $TAG"
|
||||||
else
|
# else
|
||||||
echo "main.go not found"
|
# echo "main.go not found"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
- name: Build and push Docker images
|
|
||||||
run: |
|
|
||||||
TAG=${{ env.TAG }}
|
|
||||||
make docker-build-release tag=$TAG
|
|
||||||
|
|
||||||
- name: Build binaries
|
- name: Build binaries
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
21
Makefile
21
Makefile
@@ -1,22 +1,5 @@
|
|||||||
|
|
||||||
all: build push
|
all: go-build-release
|
||||||
|
|
||||||
docker-build-release:
|
|
||||||
@if [ -z "$(tag)" ]; then \
|
|
||||||
echo "Error: tag is required. Usage: make build-all tag=<tag>"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
docker buildx build --platform linux/arm64,linux/amd64 -t fosrl/olm:latest -f Dockerfile --push .
|
|
||||||
docker buildx build --platform linux/arm64,linux/amd64 -t fosrl/olm:$(tag) -f Dockerfile --push .
|
|
||||||
|
|
||||||
build:
|
|
||||||
docker build -t fosrl/olm:latest .
|
|
||||||
|
|
||||||
push:
|
|
||||||
docker push fosrl/olm:latest
|
|
||||||
|
|
||||||
test:
|
|
||||||
docker run fosrl/olm:latest
|
|
||||||
|
|
||||||
local:
|
local:
|
||||||
CGO_ENABLED=0 go build -o olm
|
CGO_ENABLED=0 go build -o olm
|
||||||
@@ -29,4 +12,4 @@ go-build-release:
|
|||||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o bin/olm_windows_amd64.exe
|
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o bin/olm_windows_amd64.exe
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm olm
|
rm olm
|
||||||
Reference in New Issue
Block a user