mirror of
https://github.com/tgdrive/teldrive.git
synced 2024-09-20 08:15:55 +08:00
ci: add dev release action
This commit is contained in:
parent
3ba530ec7d
commit
66cdb5bac9
43
.github/workflows/release-dev.yml
vendored
Normal file
43
.github/workflows/release-dev.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
name: Goreleaser
|
||||
|
||||
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: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- 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 }}
|
|
@ -3,10 +3,9 @@ name: Goreleaser
|
|||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
- "[0-9].[0-9]+.[0-9]+"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
permissions: write-all
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
|
@ -17,10 +16,22 @@ jobs:
|
|||
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: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v5
|
||||
|
@ -29,4 +40,4 @@ jobs:
|
|||
version: latest
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
47
.goreleaser.dev.yml
Normal file
47
.goreleaser.dev.yml
Normal file
|
@ -0,0 +1,47 @@
|
|||
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
|
||||
dockers:
|
||||
- image_templates:
|
||||
- "ghcr.io/{{ .Env.GITHUB_ACTOR }}/{{ .ProjectName }}:{{ .Tag }}"
|
||||
use: buildx
|
||||
dockerfile: Dockerfile
|
||||
|
||||
checksum:
|
||||
name_template: "{{ .ProjectName }}_checksums.txt"
|
||||
|
||||
archives:
|
||||
- name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
- 'README'
|
||||
- Merge pull request
|
||||
- Merge branch
|
||||
release:
|
||||
draft: true
|
|
@ -24,8 +24,8 @@ builds:
|
|||
- arm64
|
||||
dockers:
|
||||
- image_templates:
|
||||
- "gcr.io/{{ .Env.GITHUB_ACTOR }}/{{ .ProjectName }}/server:{{ .Tag }}"
|
||||
- "gcr.io/{{ .Env.GITHUB_ACTOR }}/{{ .ProjectName }}/server:latest"
|
||||
- "ghcr.io/{{ .Env.GITHUB_ACTOR }}/{{ .ProjectName }}/server:{{ .Tag }}"
|
||||
- "ghcr.io/{{ .Env.GITHUB_ACTOR }}/{{ .ProjectName }}/server:latest"
|
||||
use: buildx
|
||||
dockerfile: Dockerfile
|
||||
goos:
|
22
Makefile
22
Makefile
|
@ -2,17 +2,17 @@ FRONTEND_DIR := ui/teldrive-ui
|
|||
BUILD_DIR := bin
|
||||
APP_NAME := teldrive
|
||||
|
||||
GIT_VERSION := $(shell git describe --tags --abbrev=0)
|
||||
GIT_VERSION := $(shell git describe --tags --abbrev=0 --exclude='*dev*')
|
||||
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
|
||||
|
||||
GOOS ?= $(shell go env GOOS)
|
||||
GOARCH ?= $(shell go env GOARCH)
|
||||
|
||||
.PHONY: all build run clean frontend backend run sync-ui tag-and-push retag
|
||||
|
||||
.PHONY: all build run clean frontend backend run sync-ui tag-and-push retag dev-tag dev-retag
|
||||
|
||||
all: build
|
||||
|
||||
ifdef ComSpec
|
||||
|
@ -75,4 +75,16 @@ patch-version:
|
|||
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))
|
||||
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)
|
Loading…
Reference in a new issue