refactor: remove dev workflow

This commit is contained in:
divyam234 2024-03-19 22:44:00 +05:30
parent b1b5dcdc4c
commit 8d7245cd5b
4 changed files with 14 additions and 102 deletions

View file

@ -1,36 +0,0 @@
name: Goreleaser-Dev
on:
push:
tags:
- "[0-9].[0-9]+.[0-9]+-dev"
permissions: write-all
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --config .goreleaser.dev.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -3,8 +3,8 @@ name: Goreleaser
on:
push:
tags:
- "[0-9].[0-9]+.[0-9]+"
- "*"
permissions: write-all
jobs:
@ -35,10 +35,6 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set env
run: |
echo "GORELEASER_PREVIOUS_TAG=$(git tag --sort=v:refname | grep -E '[0-9]+\.[0-9]+\.[0-9]+$' | tail -2 | head -1)" >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5

View file

@ -1,35 +0,0 @@
project_name: teldrive
env:
- GO111MODULE=on
before:
hooks:
- make frontend
builds:
- env:
- CGO_ENABLED=0
main: cmd/teldrive/main.go
flags: -trimpath
ldflags: "-extldflags -static -s -w"
mod_timestamp: "{{ .CommitTimestamp }}"
goos:
- linux
- windows
goarch:
- amd64
checksum:
name_template: "{{ .ProjectName }}_checksums.txt"
archives:
- name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
format_overrides:
- goos: windows
format: zip
changelog:
disable: true
release:
draft: true

View file

@ -2,10 +2,9 @@ FRONTEND_DIR := ui/teldrive-ui
BUILD_DIR := bin
APP_NAME := teldrive
GIT_VERSION := $(shell git describe --tags --abbrev=0 --exclude='*dev*')
GIT_TAG := $(shell git describe --tags --abbrev=0)
GIT_COMMIT := $(shell git rev-parse --short HEAD)
GIT_LINK := $(shell git remote get-url origin)
GIT_DEV_TAG := $(shell git describe --tags --abbrev=0 --match='*-dev')
ENV_FILE := $(FRONTEND_DIR)/.env
MODULE_PATH := $(shell go list -m)
@ -30,14 +29,14 @@ frontend: $(ENV_FILE)
$(ENV_FILE): Makefile
ifdef ComSpec
@echo 'VITE_VERSION_INFO={"version": "$(GIT_VERSION)", "commit": "$(GIT_COMMIT)", "link": "$(GIT_LINK)"}' | Out-File -encoding utf8 $(ENV_FILE)
@echo 'VITE_VERSION_INFO={"version": "$(GIT_TAG)", "commit": "$(GIT_COMMIT)", "link": "$(GIT_LINK)"}' | Out-File -encoding utf8 $(ENV_FILE)
else
@echo 'VITE_VERSION_INFO={"version": "$(GIT_VERSION)", "commit": "$(GIT_COMMIT)", "link": "$(GIT_LINK)"}' > $(ENV_FILE)
@echo 'VITE_VERSION_INFO={"version": "$(GIT_TAG)", "commit": "$(GIT_COMMIT)", "link": "$(GIT_LINK)"}' > $(ENV_FILE)
endif
backend:
@echo "Building backend for $(GOOS)/$(GOARCH)..."
go build -trimpath -ldflags "-s -w -X $(MODULE_PATH)/internal/config.Version=$(GIT_VERSION) -extldflags=-static" -o $(BUILD_DIR)/$(APP_NAME)$(BINARY_EXTENSION)
go build -trimpath -ldflags "-s -w -X $(MODULE_PATH)/internal/config.Version=$(GIT_TAG) -extldflags=-static" -o $(BUILD_DIR)/$(APP_NAME)$(BINARY_EXTENSION)
build: frontend backend
@echo "Building complete."
@ -63,29 +62,17 @@ sync-ui:
retag:
@echo "Retagging..."
git tag -d $(GIT_VERSION)
git push --delete origin $(GIT_VERSION)
git tag -a $(GIT_VERSION) -m "Recreated tag $(GIT_VERSION)"
git push origin $(GIT_VERSION)
git tag -d $(GIT_TAG)
git push --delete origin $(GIT_TAG)
git tag -a $(GIT_TAG) -m "Recreated tag $(GIT_TAG)"
git push origin $(GIT_TAG)
patch-version:
@echo "Patching version..."
git tag -a $(shell semver -i patch $(GIT_VERSION)) -m "Release $(shell semver -i patch $(GIT_VERSION))"
git push origin $(shell semver -i patch $(GIT_VERSION))
git tag -a $(shell semver -i patch $(GIT_TAG)) -m "Release $(shell semver -i patch $(GIT_TAG))"
git push origin $(shell semver -i patch $(GIT_TAG))
minor-version:
@echo "Minoring version..."
git tag -a $(shell semver -i minor $(GIT_VERSION)) -m "Release $(shell semver -i minor $(GIT_VERSION))"
git push origin $(shell semver -i minor $(GIT_VERSION))
dev-patch:
@echo "Patching version..."
git tag $(shell semver -i patch $(GIT_DEV_TAG))
git push origin $(shell semver -i patch $(GIT_DEV_TAG))
dev-retag:
@echo "Retagging..."
git tag -d $(GIT_DEV_TAG)
git push --delete origin $(GIT_DEV_TAG)
git tag $(GIT_DEV_TAG)
git push origin $(GIT_DEV_TAG)
git tag -a $(shell semver -i minor $(GIT_TAG)) -m "Release $(shell semver -i minor $(GIT_TAG))"
git push origin $(shell semver -i minor $(GIT_TAG))