Skip to content

Commit 3bac392

Browse files
author
oanatmaria
committed
Add release ci
1 parent 21c5d8f commit 3bac392

9 files changed

Lines changed: 748 additions & 3 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ env:
1818

1919

2020
jobs:
21-
tests:
22-
name: Run tests
21+
test:
22+
name: Run test
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: Read Configuration
@@ -65,3 +65,79 @@ jobs:
6565
- name: Run tests
6666
run: |
6767
poetry run pytest -vv
68+
release:
69+
runs-on: ubuntu-latest
70+
needs: test
71+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
72+
73+
name: Release to pypi
74+
steps:
75+
- name: Read Configuration
76+
uses: hashicorp/vault-action@v2.4.1
77+
id: vault
78+
with:
79+
url: ${{ env.VAULT_ADDR }}
80+
token: ${{ secrets.VAULT_TOKEN }}
81+
secrets: |
82+
kv/data/github "SSH_PRIVATE_KEY" | SSH_PRIVATE_KEY;
83+
kv/data/pypi "USERNAME" | POETRY_HTTP_BASIC_PYPI_USERNAME;
84+
kv/data/pypi "PASSWORD" | POETRY_HTTP_BASIC_PYPI_PASSWORD;
85+
86+
- name: Checkout
87+
uses: actions/checkout@v3
88+
with:
89+
fetch-depth: 0
90+
91+
- name: Setup Go
92+
uses: actions/setup-go@v2
93+
with:
94+
go-version: ${{ env.GO_VERSION }}
95+
96+
- name: Setup caching
97+
uses: actions/cache@v2
98+
with:
99+
path: |
100+
~/.cache/go-build
101+
~/go/pkg/mod
102+
.ext
103+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum', 'Depfile') }}
104+
restore-keys: |
105+
${{ runner.os }}-go-
106+
107+
- name: Install dependencies
108+
run: |
109+
mkdir -p $HOME/.ssh
110+
umask 0077 && echo -e "${SSH_PRIVATE_KEY}" > $HOME/.ssh/id_rsa
111+
ssh-keyscan github.com >> $HOME/.ssh/known_hosts
112+
113+
git config --global url."git@github.com:".insteadOf https://github.com/
114+
git config --global user.email "github-bot@aserto.com"
115+
git config --global user.name "Aserto Bot"
116+
117+
eval `ssh-agent`
118+
ssh-add $HOME/.ssh/id_rsa
119+
120+
go run mage.go deps
121+
122+
- name: Set up Python
123+
uses: actions/setup-python@v4
124+
with:
125+
python-version: '3.10'
126+
127+
- name: Install Poetry
128+
uses: snok/install-poetry@v1
129+
130+
- name: Build and push the python package
131+
run: go run mage.go release
132+
133+
- name: Bump to the next version
134+
run: go run mage.go bump patch
135+
136+
- name: Commit changes
137+
uses: EndBug/add-and-commit@v9
138+
with:
139+
default_author: github_actions
140+
message: 'Bump to next version'
141+
add: 'pyproject.toml'
142+
push: origin HEAD:main
143+

Depfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
go:
3+
sver:
4+
importPath: "github.com/aserto-dev/sver/cmd/sver"
5+
version: "v1.3.13"

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/aserto-dev/python-authorizer
2+
3+
go 1.19
4+
5+
require github.com/magefile/mage v1.14.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/magefile/mage v1.14.0 h1:6QDX3g6z1YvJ4olPhT1wksUcSa/V0a1B+pJb73fBjyo=
2+
github.com/magefile/mage v1.14.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=

mage.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//go:build zeroinstall
2+
// +build zeroinstall
3+
4+
package main
5+
6+
import (
7+
"os"
8+
9+
"github.com/magefile/mage/mage"
10+
)
11+
12+
func main() { os.Exit(mage.Main()) }

magefiles/go.mod

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
module github.com/aserto-dev/python-authorizer/magefiles
2+
3+
go 1.19
4+
5+
require (
6+
github.com/aserto-dev/mage-loot v0.8.10
7+
github.com/magefile/mage v1.14.0
8+
)
9+
10+
require (
11+
github.com/aserto-dev/clui v0.8.1 // indirect
12+
github.com/fatih/color v1.13.0 // indirect
13+
github.com/fsnotify/fsnotify v1.5.4 // indirect
14+
github.com/gitleaks/go-gitdiff v0.7.4 // indirect
15+
github.com/hashicorp/hcl v1.0.0 // indirect
16+
github.com/imdario/mergo v0.3.13 // indirect
17+
github.com/kyokomi/emoji v2.2.4+incompatible // indirect
18+
github.com/magiconair/properties v1.8.6 // indirect
19+
github.com/mattn/go-colorable v0.1.12 // indirect
20+
github.com/mattn/go-isatty v0.0.14 // indirect
21+
github.com/mattn/go-runewidth v0.0.13 // indirect
22+
github.com/mitchellh/mapstructure v1.5.0 // indirect
23+
github.com/olekukonko/tablewriter v0.0.5 // indirect
24+
github.com/pelletier/go-toml v1.9.5 // indirect
25+
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
26+
github.com/pkg/errors v0.9.1 // indirect
27+
github.com/rivo/uniseg v0.2.0 // indirect
28+
github.com/rs/zerolog v1.25.0 // indirect
29+
github.com/spf13/afero v1.8.2 // indirect
30+
github.com/spf13/cast v1.5.0 // indirect
31+
github.com/spf13/jwalterweatherman v1.1.0 // indirect
32+
github.com/spf13/pflag v1.0.5 // indirect
33+
github.com/spf13/viper v1.13.0 // indirect
34+
github.com/subosito/gotenv v1.4.1 // indirect
35+
github.com/ulikunitz/xz v0.5.10 // indirect
36+
github.com/zricethezav/gitleaks/v8 v8.3.0 // indirect
37+
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
38+
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
39+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
40+
golang.org/x/text v0.3.7 // indirect
41+
gopkg.in/ini.v1 v1.67.0 // indirect
42+
gopkg.in/yaml.v2 v2.4.0 // indirect
43+
gopkg.in/yaml.v3 v3.0.1 // indirect
44+
)

0 commit comments

Comments
 (0)