diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml new file mode 100644 index 0000000..46a7c62 --- /dev/null +++ b/.github/workflows/release-docker.yml @@ -0,0 +1,43 @@ +name: CI +on: + push: + tags: + - "v*" +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + platform: [linux/amd64,linux/arm64] + env: + IS_LINUX: ${{ startsWith(matrix.platform, 'linux/') && 'true' || 'false' }} + GIT_TAG: ${{ needs.git-version.outputs.git_tag }} + steps: + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - uses: docker/metadata-action@v5 + id: meta + with: + images: damillora/phoebe + flavor: | + latest=false + tags: | + type=semver,pattern={{version}} + - name: Build and push + id: docker_build_git + uses: docker/build-push-action@v6 + with: + push: true + platforms: ${{ matrix.platform }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/release-goreleaser.yml b/.github/workflows/release-goreleaser.yml new file mode 100644 index 0000000..e5e893c --- /dev/null +++ b/.github/workflows/release-goreleaser.yml @@ -0,0 +1,28 @@ +name: CI +on: + push: + tags: + - "v*" +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/setup-go@v5 + with: + go-version: '1.23' + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + # 'latest', 'nightly', or a semver + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_CODENAME: ${{ env.RELEASE_CODENAME }} + RELEASE_SUBTITLE: ${{ env.RELEASE_SUBTITLE }} diff --git a/.gitignore b/.gitignore index 66fd13c..25eb640 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ # Dependency directories (remove the comment below to include it) # vendor/ +# Added by goreleaser init: +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..728ad77 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,62 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 2 + +project_name: phoebe + +before: + hooks: + # Build frontend first + - sh -c "cd pkg/web && npm ci && npm run build" + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + +archives: + - formats: [tar.gz] + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + formats: [zip] + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + +release: + header: >- + # Version v{{.Version}} "{{ .Env.RELEASE_CODENAME }} - {{ .Env.RELEASE_SUBTITLE }}" + + --- + + footer: >- + + --- + + Bluebird, be my salvation. diff --git a/Dockerfile b/Dockerfile index 3919200..729d8c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,6 @@ FROM node:20-alpine AS node_build WORKDIR /src COPY . . WORKDIR /src/pkg/web -RUN apk update && apk add git RUN npm ci && npm run build # Go application