Skip to content

Commit 5776340

Browse files
authored
Merge pull request #130 from section/fix-login
fix login command
2 parents 0d95730 + a7734cb commit 5776340

File tree

5 files changed

+196
-5
lines changed

5 files changed

+196
-5
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ jobs:
258258
base-branch: main
259259
download-url: https://github.com/section/sectionctl/archive/refs/tags/${{ steps.extract-version.outputs.tag-name }}.tar.gz
260260
commit-message: |
261-
{{formulaName}} {{env.MAJORVERSION}}.{{env.MINORVERSION}}.{{env.PATCHVERSION}}
261+
{{formulaName}} ${{env.VERSION}}
262262
263263
Created by https://github.com/mislav/bump-homebrew-formula-action
264264
env:

.github/workflows/test-release.yml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
name: Build and release sectionctl binaries
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
jobs:
8+
build:
9+
name: 🚧 Build binaries
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
GOOS: [linux, darwin, windows]
14+
GOARCH: [amd64, arm64]
15+
exclude:
16+
- GOOS: windows
17+
GOARCH: arm64
18+
env:
19+
VERSION: v0.0.0
20+
GOARCH: ${{ matrix.GOARCH }}
21+
GOOS: ${{ matrix.GOOS }}
22+
steps:
23+
- name: Set up Go 1.x
24+
uses: actions/setup-go@v2
25+
with:
26+
go-version: ^1.16
27+
id: go
28+
29+
- name: Check out code into the Go module directory
30+
uses: actions/checkout@v2
31+
- name: Get Version
32+
id: get_version
33+
uses: battila7/get-version-action@v2
34+
- run: echo 'MAJORVERSION="0"' >> $GITHUB_ENV
35+
- run: echo 'MINORVERSION="0"' >> $GITHUB_ENV
36+
- run: echo 'PATCHVERSION="0"' >> $GITHUB_ENV
37+
- run: echo "VERSION=v0.0.0" >> $GITHUB_ENV
38+
- name: Get dependencies
39+
run: |
40+
go get -v -t -d ./...
41+
- name: Build
42+
run: make build-release
43+
- uses: actions/upload-artifact@v2
44+
with:
45+
name: dist
46+
path: dist/
47+
- uses: actions/upload-artifact@v2
48+
with:
49+
name: sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}.tar.gz
50+
path: dist/sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}
51+
build_linux_packages:
52+
runs-on: 'ubuntu-latest'
53+
needs: build
54+
name: 🐧 Build Linux Packages (deb, rpm)
55+
strategy:
56+
matrix:
57+
GOOS: [linux]
58+
GOARCH: [amd64, arm64]
59+
env:
60+
VERSION: v0.0.0
61+
GOARCH: ${{ matrix.GOARCH }}
62+
GOOS: ${{ matrix.GOOS }}
63+
DESC: 'Section command line tool.'
64+
APP_NAME: 'sectionctl'
65+
MAINTAINER: 'alice@section.io'
66+
steps:
67+
- name: Check out code into the Go module directory
68+
uses: actions/checkout@v2
69+
- name: Download dist folder
70+
uses: actions/download-artifact@v2
71+
with:
72+
name: dist
73+
path: dist/
74+
- name: Get Version
75+
id: get_version
76+
uses: battila7/get-version-action@v2
77+
- run: echo 'MAJORVERSION="0"' >> $GITHUB_ENV
78+
- run: echo 'MINORVERSION="0"' >> $GITHUB_ENV
79+
- run: echo 'PATCHVERSION="0"' >> $GITHUB_ENV
80+
- run: echo "VERSION=v0.0.0" >> $GITHUB_ENV
81+
- run: echo "VER=0.0.0" >> $GITHUB_ENV
82+
- run: echo "NO_V_VERSION=0.0.0" >> $GITHUB_ENV
83+
- run: echo "ARCHSTRING=x86_64" >> $GITHUB_ENV
84+
if: ${{ env.GOARCH == 'amd64' }}
85+
- run: echo "ARCHSTRING=aarch64" >> $GITHUB_ENV
86+
if: ${{ env.GOARCH != 'amd64' }}
87+
- name: Copy binaries to deb package directory
88+
run: |
89+
cp -p dist/sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}/sectionctl .
90+
chmod +x sectionctl
91+
- uses: kentik/pkg@v1.0.0-rc7
92+
with:
93+
name: sectionctl
94+
version: '${{env.MAJORVERSION}}.${{env.MINORVERSION}}.${{env.PATCHVERSION}}'
95+
arch: ${{env.ARCHSTRING}}
96+
format: rpm
97+
package: packaging/linux/package.yaml
98+
- uses: kentik/pkg@v1.0.0-rc7
99+
with:
100+
name: sectionctl
101+
version: '${{env.VER}}'
102+
arch: ${{env.ARCHSTRING}}
103+
format: deb
104+
package: packaging/linux/package.yaml
105+
- run: ls *.deb *.rpm
106+
- uses: actions/upload-artifact@v2
107+
with:
108+
name: sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}.deb
109+
path: sectionctl_${{env.VER}}-1_${{ env.GOARCH }}.deb
110+
- uses: actions/upload-artifact@v2
111+
with:
112+
name: sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}.rpm
113+
path: sectionctl-${{env.MAJORVERSION}}.${{env.MINORVERSION}}.${{env.PATCHVERSION}}-1.${{ env.ARCHSTRING }}.rpm
114+
create_installer:
115+
runs-on: 'windows-latest'
116+
needs: build
117+
name: 🪟 Create Windows Installer with NSIS
118+
strategy:
119+
matrix:
120+
GOOS: [windows]
121+
GOARCH: [amd64]
122+
env:
123+
VERSION: v0.0.0
124+
GOARCH: ${{ matrix.GOARCH }}
125+
GOOS: ${{ matrix.GOOS }}
126+
DESC: 'Section command line tool.'
127+
APP_NAME: 'sectionctl'
128+
MAINTAINER: 'alice@section.io'
129+
steps:
130+
- name: Check out code into the Go module directory
131+
uses: actions/checkout@v2
132+
- name: Download dist folder
133+
uses: actions/download-artifact@v2
134+
with:
135+
name: dist
136+
path: dist/
137+
- run: echo "MAJORVERSION=0" >> $GITHUB_ENV
138+
- run: echo "MINORVERSION=0" >> $GITHUB_ENV
139+
- run: echo "PATCHVERSION=0" >> $GITHUB_ENV
140+
- run: echo "VERSION=v0.0.0" >> $GITHUB_ENV
141+
- run: echo "VER=0.0.0" >> $GITHUB_ENV
142+
- run: echo "NO_V_VERSION=0.0.0" >> $GITHUB_ENV
143+
- run: echo $env:GITHUB_ENV
144+
- name: Download EnVar plugin for NSIS
145+
uses: carlosperate/download-file-action@v1.0.3
146+
with:
147+
file-url: https://nsis.sourceforge.io/mediawiki/images/7/7f/EnVar_plugin.zip
148+
file-name: envar_plugin.zip
149+
location: ${{ github.workspace }}
150+
- name: Extract EnVar plugin
151+
run: 7z x -o"${{ github.workspace }}/NSIS_Plugins" "${{ github.workspace }}/envar_plugin.zip"
152+
- name: Create nsis installer
153+
uses: joncloud/makensis-action@v3.3
154+
with:
155+
additional-plugin-paths: ${{ github.workspace }}/NSIS_Plugins/Plugins
156+
arguments: >
157+
-DARCH=amd64
158+
-DOUTPUTFILE=sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}-installer.exe
159+
-DSECTIONCTL_VERSION=${{ env.VERSION }}
160+
-DMAJORVERSION=0
161+
-DMINORVERSION=0
162+
-DBUILDVERSION=0
163+
script-file: 'packaging/windows/nsis.sectionctl.nsi'
164+
- name: Upload artifact
165+
uses: actions/upload-artifact@v1.0.0
166+
with:
167+
name: sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}-installer.exe
168+
path: packaging/windows/sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}-installer.exe
169+
delete_excess_artifacts:
170+
runs-on: 'ubuntu-latest'
171+
needs: [build, create_installer, build_linux_packages]
172+
name: ❌ Delete unnecessary 100mb dist artifact
173+
steps:
174+
- uses: geekyeggo/delete-artifact@v1
175+
with:
176+
name: dist

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,29 @@ sectionctl install-completions
2828

2929
You can set credentials via the `SECTION_TOKEN` environment variable:
3030

31-
``` bash
31+
```bash
3232
SECTION_TOKEN=s3cr3t sectionctl accounts list
3333
```
3434

3535
## Installing
3636

37+
### Mac
38+
39+
```
40+
brew tap section/brews
41+
brew install sectionctl
42+
```
43+
44+
### Linux
45+
46+
Install the .deb or .rpm, or download the binaries for your system and put sectionctl in your PATH.
47+
48+
### Windows
49+
50+
Install with the installer exe on [the latest release](https://github.com/section/sectionctl/releases/latest).
51+
52+
### Manual Installation
53+
3754
The easiest way to install `sectionctl` is by downloading [the latest release](https://github.com/section/sectionctl/releases/latest) and putting it on your `PATH`.
3855

3956
## Developing

commands/login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (c *LoginCmd) Run() (err error) {
4646
}
4747
api.Token = t
4848
}
49-
log.Print("[INFO]\nValidating credentials...")
49+
log.Info().Msg("Validating credentials...")
5050
_, err = api.CurrentUser()
5151
if err != nil {
5252
fmt.Println("error!")

packaging/windows/nsis.install.nsh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ OutFile "${OUTPUTFILE}" # set through command line arguments
3030

3131
;--------------------------------
3232
!insertmacro MUI_PAGE_LICENSE "..\..\dist\sectionctl-${SECTIONCTL_VERSION}-windows-amd64\LICENSE"
33-
!insertmacro MUI_PAGE_COMPONENTS
34-
!insertmacro MUI_PAGE_INSTFILES
3533
# Install sectionctl binary
3634
Section "sectionctl" SECTIONCTL_IDX
3735
SetOutPath $INSTDIR

0 commit comments

Comments
 (0)