Skip to content

Commit 7437b83

Browse files
committed
add go releaser & readme
1 parent fe8982e commit 7437b83

File tree

3 files changed

+136
-0
lines changed

3 files changed

+136
-0
lines changed

.github/workflows/goreleaser.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: goreleaser
2+
3+
on:
4+
pull_request:
5+
push:
6+
tags:
7+
- '*'
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
-
13+
name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
-
18+
name: Set up Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: 1.15
22+
-
23+
name: Run GoReleaser
24+
uses: goreleaser/goreleaser-action@v2
25+
with:
26+
version: latest
27+
args: release --rm-dist
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
project_name: updateApiClient
2+
before:
3+
hooks:
4+
- go mod tidy
5+
# - docker login
6+
changelog:
7+
sort: asc
8+
filters:
9+
exclude:
10+
- '^docs:'
11+
- '^test:'
12+
- Merge pull request
13+
- Merge branch
14+
build:
15+
skip: true
16+
release:
17+
github:
18+
prerelease: auto

README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,91 @@
11
# update-api-1c
22
Client for update-api.1c.ru
3+
4+
[![go.dev][pkg-img]][pkg] [![goreport][report-img]][report] [![build][build-img]][build] [![coverage][cov-img]][cov] ![stability-stable][stability-img]
5+
6+
7+
## How to use
8+
9+
### Quick start
10+
11+
```go
12+
package main
13+
14+
import (
15+
apiClient "github.com/v8platform/updateApiClient"
16+
17+
"io"
18+
"io/ioutil"
19+
"log"
20+
"os"
21+
"path/filepath"
22+
"strings"
23+
)
24+
25+
func main() {
26+
27+
client := apiClient.NewClient("ITS_USER", "ITS_PASSWORD")
28+
29+
updateInfo, err := client.GetUpdateInfo("Accounting",
30+
"3.0.88.22",
31+
apiClient.NewProgramOrRedactionUpdateType, "8.3.15.2107")
32+
33+
if err != nil {
34+
log.Fatal(err)
35+
}
36+
37+
updateData, err := client.GetUpdate(updateInfo.ConfigurationUpdate.ProgramVersionUin, updateInfo.ConfigurationUpdate.UpgradeSequence)
38+
39+
if err != nil {
40+
log.Fatal(err)
41+
}
42+
43+
for _, data := range updateData.ConfigurationUpdateDataList {
44+
45+
updateDataFile, err := client.GetConfigurationUpdateData(data)
46+
47+
if err != nil {
48+
log.Fatal(err)
49+
}
50+
51+
log.Println("Download:", updateDataFile.UpdateFileUrl)
52+
53+
distPath := strings.ReplaceAll(updateDataFile.TemplatePath, "\\", string(os.PathSeparator))
54+
distPath = filepath.Join(".", distPath)
55+
log.Println("Path:", distPath)
56+
57+
err = os.MkdirAll(distPath, os.ModeDir)
58+
if err != nil {
59+
log.Fatal(err)
60+
}
61+
62+
f, err := ioutil.TempFile("", "."+updateDataFile.UpdateFileFormat)
63+
if err != nil {
64+
log.Fatal(err)
65+
}
66+
_, err = io.Copy(f, updateDataFile)
67+
68+
f.Close()
69+
updateDataFile.Close()
70+
71+
err = apiClient.UnzipFile(f.Name(), distPath)
72+
if err != nil {
73+
log.Fatal(err)
74+
}
75+
76+
}
77+
78+
}
79+
80+
```
81+
82+
[pkg-img]: http://img.shields.io/badge/godoc-reference-5272B4.svg
83+
[pkg]: https://godoc.org/github.com/v8platform/updateApiClient
84+
[report-img]: https://goreportcard.com/badge/github.com/v8platform/updateApiClient
85+
[report]: https://goreportcard.com/report/github.com/v8platform/updateApiClient
86+
[build-img]: https://github.com/v8platform/updateApiClient/workflows/goreleaser/badge.svg
87+
[build]: https://github.com/v8platform/updateApiClient/actions
88+
[cov-img]: http://gocover.io/_badge/github.com/v8platform/updateApiClient
89+
[cov]: https://gocover.io/github.com/v8platform/updateApiClient
90+
[stability-img]: https://img.shields.io/badge/stability-stable-green.svg
91+

0 commit comments

Comments
 (0)