Skip to content

Commit

Permalink
Integrate webapp build into goreleaser setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mengdaming committed Mar 13, 2024
1 parent c935d78 commit bcf2d0a
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
fetch-depth: 0

- name: Skip Duplicate Actions
- name: Skip duplicate actions
uses: fkirc/skip-duplicate-actions@v5.3.1

- name: Set up Go
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/go_releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ jobs:
go-version: '1.21'
check-latest: true
cache-dependency-path: src/go.sum
- name: Run GoReleaser
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'npm'
cache-dependency-path: webapp/package-lock.json
- name: Run npm install
working-directory: webapp
run: npm ci
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ jobs:
with:
fetch-depth: 0

- name: Skip Duplicate Actions
- name: Skip duplicate actions
uses: fkirc/skip-duplicate-actions@v5.3.1

- name: Setup Node.js ${{ matrix.node-version }}
- name: Setup node.js version ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: webapp/package-lock.json

- name: Install npm
- name: Run npm install
run: npm ci

- name: Run tests
Expand Down
3 changes: 2 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project_name: tcr
before:
hooks:
- make tidy
- make -C webapp build
builds:
- id: "tcr"
dir: src
Expand All @@ -18,7 +19,7 @@ builds:
- -X {{.Env.CONFIG_PKG}}.BuildArch={{.Arch}}
- -X {{.Env.CONFIG_PKG}}.BuildCommit={{.Commit}}
- -X {{.Env.CONFIG_PKG}}.BuildDate={{.Date}}
- -X {{.Env.CONFIG_PKG}}.BuildAuthor=goreleaser
- -X {{.Env.CONFIG_PKG}}.BuildAuthor=murex
goos:
- linux
- windows
Expand Down
5 changes: 2 additions & 3 deletions src/settings/build_info.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2023 Murex
Copyright (c) 2024 Murex
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,7 +24,6 @@ package settings

import (
"fmt"
"time"
)

// Below variables are set at build time through -ldflags
Expand All @@ -33,7 +32,7 @@ var (
BuildOs = "unknown"
BuildArch = "unknown"
BuildCommit = "none"
BuildDate = time.Time{}.Format(time.RFC3339)
BuildDate = "0001-01-01T00:00:00Z"
BuildAuthor = "unknown"
)

Expand Down
2 changes: 1 addition & 1 deletion src/settings/build_info_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2022 Murex
Copyright (c) 2024 Murex
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 3 additions & 0 deletions webapp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ build: setup
run:
@npm start

.PHONY: clean
clean:
@npm run clean
8 changes: 6 additions & 2 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
"test": "ng test --source-map=false --browsers=ChromeHeadless --watch=false",
"test-cov": "ng test --source-map=false --browsers=ChromeHeadless --watch=false --code-coverage",
"test-watch": "ng test",
"lint": "ng lint"
"lint": "ng lint",
"clean": "rm -rf node_modules ../src/http/static/webapp",
"reinstall": "npm run clean && npm install",
"rebuild": "npm run reinstall && npm run build",
"rebuild-prod": "npm run reinstall && npm run build-prod"
},
"private": true,
"dependencies": {
Expand Down Expand Up @@ -59,4 +63,4 @@
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.2.2"
}
}
}
5 changes: 2 additions & 3 deletions webapp/src/app/components/tcr-about/tcr-about.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ <h1 class="mbr-fonts-style mbr-bold mbr-section-title1 display-4">{{ title }}</h
<div class="text-wrap vcenter">
<h2 class="mbr-fonts-style mbr-bold mbr-section-title3 display-5">Running TCR Version</h2>
<table class="mbr-fonts-style text1 mbr-text display-6">
<caption>TCR Build Information</caption>
<tr>
<th>Version</th>
<td>{{ buildInfo.version }}</td>
Expand Down Expand Up @@ -44,8 +43,8 @@ <h2 class="mbr-fonts-style mbr-bold mbr-section-title3 display-5">Running TCR Ve
<div class="text-wrap vcenter">
<h2 class="mbr-fonts-style mbr-bold mbr-section-title3 display-5">TCR on GitHub</h2>
<p>Willing to contribute?
<br>TCR is available as open-source on GitHub at
<br><a href="https://github.com/murex/TCR">github.com/murex/TCR</a>
<br>TCR is available on GitHub at
<a href="https://github.com/murex/TCR" target=”_blank”>github.com/murex/TCR</a>
</p>
</div>
</div>
Expand Down

0 comments on commit bcf2d0a

Please sign in to comment.