This repository has been archived by the owner on Dec 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from b3n4kh/feature/goreleaser
Feature/goreleaser
- Loading branch information
Showing
6 changed files
with
182 additions
and
12 deletions.
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,44 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Fetch all tags | ||
run: git fetch --force --tags | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
cache: true | ||
- name: get ghcr owner repository | ||
run: | | ||
echo "GHCR_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV} | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GHCR_OWNER: ${{ env.GHCR_OWNER }} |
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 |
---|---|---|
|
@@ -2,4 +2,8 @@ | |
config*.yml | ||
!config.default.yml | ||
mailwhale | ||
*.db | ||
node_modules | ||
package-lock.json | ||
package.json | ||
dist | ||
*.db |
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,47 @@ | ||
--- | ||
builds: | ||
- id: mailwhale-builds | ||
binary: mailwhale | ||
dir: . | ||
before: | ||
hooks: | ||
- sudo npm install -g yarn | ||
- yarn --cwd webui | ||
- yarn --cwd webui build | ||
- cp config.default.yml config.yml | ||
archives: | ||
- id: mailwhale-archives | ||
builds: | ||
- mailwhale-builds | ||
files: | ||
- LICENSE | ||
- README.md | ||
- webui/public/* | ||
- config.yml | ||
- templates/* | ||
- version.txt | ||
replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
386: i386 | ||
amd64: x86_64 | ||
name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
dockers: | ||
- ids: | ||
- mailwhale-builds | ||
goos: linux | ||
goarch: amd64 | ||
dockerfile: Dockerfile-goreleaser | ||
extra_files: | ||
- "version.txt" | ||
- "config.yml" | ||
- "LICENSE" | ||
- "README.md" | ||
- "templates/" | ||
- "webui/" | ||
|
||
image_templates: | ||
- "ghcr.io/{{ .Env.GHCR_OWNER }}/mailwhale:latest" | ||
- "ghcr.io/{{ .Env.GHCR_OWNER }}/mailwhale:{{ .Tag }}" | ||
release: | ||
mode: replace |
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
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,31 @@ | ||
# Build Stage | ||
|
||
FROM golang:1.19 AS api-build-env | ||
|
||
WORKDIR /app | ||
|
||
FROM node:18 AS ui-build-env | ||
|
||
WORKDIR /src | ||
ADD webui . | ||
RUN yarn && \ | ||
yarn build | ||
|
||
# Run Stage | ||
|
||
# When running the application using `docker run`, you can pass environment variables | ||
# to override config values using `-e` syntax. | ||
|
||
FROM alpine | ||
WORKDIR /app | ||
|
||
COPY mailwhale README.md version.txt LICENSE config.yml templates/ ./ | ||
COPY --from=ui-build-env /src/public ./webui/public | ||
|
||
ENV MW_ENV=prod | ||
ENV MW_WEB_LISTEN_V4=0.0.0.0:3000 | ||
ENV MW_STORE_PATH=/data/data.json.db | ||
|
||
VOLUME /data | ||
|
||
ENTRYPOINT ./mailwhale |
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