Skip to content

Commit

Permalink
update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yuudi committed Aug 7, 2021
1 parent 5788267 commit 6259b0f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 13 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,36 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
# - name: Minify HTML files
# run: |
# npm install html-minifier -g
# html-minifier --collapse-whitespace --minify-css true --minify-js true index.html>index.min.html
# html-minifier --collapse-whitespace --minify-css true --minify-js true receive.html>receive.min.html
# mv index.min.html index.html
# mv receive.min.html receive.html

- name: Build
run: |
sh minify.sh
export GOOS=linux
export GOARCH=amd64
go build -trimpath -ldflags="-s -w" -o "dist/onesend" .
go build -trimpath -ldflags="-s -w" -o "dist/onesend-amd64" .
export GOOS=linux
export GOARCH=arm64
go build -trimpath -ldflags="-s -w" -o "dist/onesend-arm64" .
export GOOS=windows
export GOARCH=amd64
go build -trimpath -ldflags="-s -w" -o "dist/onesend.exe" .
cp config.sample.toml dist/config.toml
touch dist/token.txt
cd dist
tar zcf onesend-test-${GITHUB_SHA:0:7}-linux-x86_64.tar.gz onesend
zip onesend-test-${GITHUB_SHA:0:7}-windows-x86_64.zip onesend.exe
mv onesend-amd64 onesend
tar Jcf onesend-ci-${GITHUB_SHA:0:7}-linux-x86_64.tar.xz onesend config.toml token.txt
mv onesend-arm64 onesend
tar Jcf onesend-ci-${GITHUB_SHA:0:7}-linux-arm64.tar.xz onesend config.toml token.txt
zip onesend-ci-${GITHUB_SHA:0:7}-windows-x86_64.zip onesend.exe config.toml token.txt
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: executable
path: |
dist/*.tar.gz
dist/*.tar.xz
dist/*.zip
1 change: 1 addition & 0 deletions config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ClientID = ""
ClientSecret = ""
AccountArea = "global"
SavePath = "/onesend"
Drive = "/me/drive"

[Sender]
Listen = "0.0.0.0:7777"
1 change: 0 additions & 1 deletion homepage.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ <h1>Share your files</h1>
<button id="upload-button" class="action-button" disabled>
Upload
</button>
<div id="upload-process"></div>
<div id="main-display"></div>
</div>
</body>
Expand Down
18 changes: 18 additions & 0 deletions minify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
npm install html-minifier uglifycss uglify-js -g

html-minifier --collapse-whitespace --minify-css true --minify-js true homepage.html >homepage.min.html
mv homepage.min.html homepage.html
html-minifier --collapse-whitespace --minify-css true --minify-js true receive.html >receive.min.html
mv receive.min.html receive.html

uglifycss assets/homepage.css >assets/homepage.min.css
mv assets/homepage.min.css assets/homepage.css
uglifycss assets/receive.css >assets/receive.min.css
mv assets/receive.min.css assets/receive.css

uglifyjs assets/homepage.js >assets/homepage.min.js
mv assets/homepage.min.js assets/homepage.js
uglifyjs assets/receive.js >assets/receive.min.js
mv assets/receive.min.js assets/receive.js
uglifyjs assets/human-readable.js >assets/human-readable.min.js
mv assets/human-readable.min.js assets/human-readable.js
4 changes: 4 additions & 0 deletions onesend.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ func entry() error {
c.Header("Cache-Control", "public, max-age=604800")
c.Data(200, "text/html", publicIndex)
})
r.GET("/index.html", func(c *gin.Context) {
c.Header("Cache-Control", "public, max-age=604800")
c.Data(200, "text/html", publicIndex)
})
r.GET("/s/:read_id", func(c *gin.Context) {
//readID := c.Param("read_id")
//if pusher := c.Writer.Pusher(); pusher != nil {
Expand Down

0 comments on commit 6259b0f

Please sign in to comment.