-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
224 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Build, Package, Release [dev] | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: "1.21" | ||
|
||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.MO_CLI_TOKEN }} | ||
|
||
- name: Create Sematic Release Version | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "ruedigerp" | ||
git config --global credential.helper cache | ||
npx standard-version --prerelease dev | ||
git push --follow-tags origin main | ||
- name: Get the current version | ||
id: get_version | ||
run: echo "VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV | ||
|
||
- name: Create release in another repo | ||
run: | | ||
echo "Creating release ${VERSION}" | ||
gh release create refs/tags/${VERSION} --title "Release ${VERSION}" --repo mogenius/homebrew-mocli-dev | ||
env: | ||
GH_TOKEN: ${{ secrets.MO_CLI_TOKEN }} | ||
|
||
- name: Execute make all | ||
run: make -f Makefile-dev all | ||
|
||
- name: Package artefacts | ||
run: | | ||
for file in builds/*; do | ||
tar -czvf builds/$(basename "$file").tar.gz -C builds $(basename "$file") | ||
done | ||
ls -lisa builds | ||
- name: Upload tarballs/executables | ||
run: | | ||
ls -lisa builds | ||
for tarball in builds/*.tar.gz; do | ||
gh release upload "${{ env.VERSION }}" "$tarball" --repo ruedigerp/cloudflare-dns-manager-homebrew | ||
done | ||
gh release upload "${{ env.VERSION }}" "builds/mocli-dev-${{ env.VERSION }}-windows-amd64" --repo ruedigerp/cloudflare-dns-manager-homebrew | ||
env: | ||
GH_TOKEN: ${{ secrets.MO_CLI_TOKEN }} | ||
|
||
- name: Update Homebrew & Scoop | ||
run: | | ||
./release-dev.sh | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "ruedigerp" | ||
git config --global credential.helper cache | ||
git clone https://${{secrets.MO_CLI_TOKEN}}@github.com/ruedigerp/cloudflare-dns-manager-homebrew | ||
cd homebrew-mocli-dev | ||
cp ../mocli-dev.rb . | ||
cp ../mocli-dev.json . | ||
cp ../CHANGELOG.md . | ||
git add . | ||
git commit -m " ${{ env.VERSION }}" | ||
git push | ||
env: | ||
GH_TOKEN: ${{ secrets.MO_CLI_TOKEN }} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
config.yaml | ||
dns-manager | ||
*.yaml | ||
config*.yaml |
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,70 @@ | ||
BINARY_NAME=dns-manager | ||
|
||
GO=go | ||
GOBUILD=$(GO) build | ||
GOCLEAN=$(GO) clean | ||
GOTEST=$(GO) test | ||
GOGET=$(GO) get | ||
|
||
# Ensure linker embeds versioning information | ||
VERSION=${shell git describe --tags $(git rev-list --tags --max-count=1)} | ||
COMMIT_HASH=$(shell git rev-parse --short HEAD) | ||
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) | ||
BUILD_TIMESTAMP=$(shell date) | ||
LDFLAGS=-s -w -extldflags= \ | ||
-X 'dns-manager/core.GitCommitHash=$(COMMIT_HASH)' \ | ||
-X 'dns-manager/core.Branch=$(GIT_BRANCH)' \ | ||
-X 'dns-manager/core.BuildTimestamp=$(BUILD_TIMESTAMP)' \ | ||
-X 'dns-manager/core.Ver=$(VERSION)' \ | ||
-X 'dns-manager/core.Agent=mocli' \ | ||
-X 'dns-manager/core.Stage=prod' | ||
|
||
all: darwin_arm64 darwin_amd64 linux_amd64 linux_386 linux_arm64 linux_arm windows_amd64 windows_386 | ||
|
||
tarballs: all | ||
for file in builds/*; do \ | ||
tar -czvf builds/`basename "$$file"`.tar.gz -C builds `basename "$$file"`; \ | ||
done | ||
|
||
clean: | ||
$(GOCLEAN) | ||
rm -f $(BINARY_NAME)-$(VERSION)-darwin-amd64 | ||
rm -f $(BINARY_NAME)-$(VERSION)-darwin-386 | ||
rm -f $(BINARY_NAME)-$(VERSION)-linux-amd64 | ||
rm -f $(BINARY_NAME)-$(VERSION)-linux-386 | ||
rm -f $(BINARY_NAME)-$(VERSION)-linux-arm64 | ||
rm -f $(BINARY_NAME)-$(VERSION)-linux-arm | ||
rm -f $(BINARY_NAME)-$(VERSION)-windows-amd64 | ||
rm -f $(BINARY_NAME)-$(VERSION)-windows-386 | ||
|
||
test: | ||
$(GOTEST) -v ./... | ||
|
||
darwin_arm64: | ||
GOOS=darwin GOARCH=arm64 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-darwin-arm64 -v | ||
|
||
darwin_amd64: | ||
GOOS=darwin GOARCH=amd64 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-darwin-amd64 -v | ||
|
||
linux_amd64: | ||
GOOS=linux GOARCH=amd64 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-linux-amd64 -v | ||
|
||
linux_386: | ||
GOOS=linux GOARCH=386 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-linux-386 -v | ||
|
||
linux_arm64: | ||
GOOS=linux GOARCH=arm64 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-linux-arm64 -v | ||
|
||
linux_arm: | ||
GOOS=linux GOARCH=arm GOARM=7 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-linux-arm -v | ||
|
||
windows_amd64: | ||
GOOS=windows GOARCH=amd64 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-windows-amd64 -v | ||
|
||
windows_386: | ||
GOOS=windows GOARCH=386 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-windows-386 -v | ||
|
||
deps: | ||
$(GOGET) ./... | ||
|
||
.PHONY: |
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,70 @@ | ||
BINARY_NAME=dns-manager | ||
|
||
GO=go | ||
GOBUILD=$(GO) build | ||
GOCLEAN=$(GO) clean | ||
GOTEST=$(GO) test | ||
GOGET=$(GO) get | ||
|
||
# Ensure linker embeds versioning information | ||
VERSION=${shell git describe --tags $(git rev-list --tags --max-count=1)} | ||
COMMIT_HASH=$(shell git rev-parse --short HEAD) | ||
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) | ||
BUILD_TIMESTAMP=$(shell date) | ||
LDFLAGS=-s -w -extldflags= \ | ||
-X 'dns-manager/core.GitCommitHash=$(COMMIT_HASH)' \ | ||
-X 'dns-manager/core.Branch=$(GIT_BRANCH)' \ | ||
-X 'dns-manager/core.BuildTimestamp=$(BUILD_TIMESTAMP)' \ | ||
-X 'dns-manager/core.Ver=$(VERSION)' \ | ||
-X 'dns-manager/core.Agent=mocli-dev' \ | ||
-X 'dns-manager/core.Stage=dev' | ||
|
||
all: darwin_arm64 darwin_amd64 linux_amd64 linux_386 linux_arm64 linux_arm windows_amd64 windows_386 | ||
|
||
tarballs: all | ||
for file in builds/*; do \ | ||
tar -czvf builds/`basename "$$file"`.tar.gz -C builds `basename "$$file"`; \ | ||
done | ||
|
||
clean: | ||
$(GOCLEAN) | ||
rm -f $(BINARY_NAME)-$(VERSION)-darwin-amd64 | ||
rm -f $(BINARY_NAME)-$(VERSION)-darwin-386 | ||
rm -f $(BINARY_NAME)-$(VERSION)-linux-amd64 | ||
rm -f $(BINARY_NAME)-$(VERSION)-linux-386 | ||
rm -f $(BINARY_NAME)-$(VERSION)-linux-arm64 | ||
rm -f $(BINARY_NAME)-$(VERSION)-linux-arm | ||
rm -f $(BINARY_NAME)-$(VERSION)-windows-amd64 | ||
rm -f $(BINARY_NAME)-$(VERSION)-windows-386 | ||
|
||
test: | ||
$(GOTEST) -v ./... | ||
|
||
darwin_arm64: | ||
GOOS=darwin GOARCH=arm64 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-darwin-arm64 -v | ||
|
||
darwin_amd64: | ||
GOOS=darwin GOARCH=amd64 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-darwin-amd64 -v | ||
|
||
linux_amd64: | ||
GOOS=linux GOARCH=amd64 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-linux-amd64 -v | ||
|
||
linux_386: | ||
GOOS=linux GOARCH=386 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-linux-386 -v | ||
|
||
linux_arm64: | ||
GOOS=linux GOARCH=arm64 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-linux-arm64 -v | ||
|
||
linux_arm: | ||
GOOS=linux GOARCH=arm GOARM=7 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-linux-arm -v | ||
|
||
windows_amd64: | ||
GOOS=windows GOARCH=amd64 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-windows-amd64 -v | ||
|
||
windows_386: | ||
GOOS=windows GOARCH=386 $(GOBUILD) -ldflags="$(LDFLAGS)" -o builds/$(BINARY_NAME)-$(VERSION)-windows-386 -v | ||
|
||
deps: | ||
$(GOGET) ./... | ||
|
||
.PHONY: |