Skip to content

Commit

Permalink
Add release ci
Browse files Browse the repository at this point in the history
  • Loading branch information
oanatmaria committed Jan 16, 2024
1 parent 21c5d8f commit 3bac392
Show file tree
Hide file tree
Showing 9 changed files with 748 additions and 3 deletions.
80 changes: 78 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ env:


jobs:
tests:
name: Run tests
test:
name: Run test
runs-on: ubuntu-latest
steps:
- name: Read Configuration
Expand Down Expand Up @@ -65,3 +65,79 @@ jobs:
- name: Run tests
run: |
poetry run pytest -vv
release:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

name: Release to pypi
steps:
- name: Read Configuration
uses: hashicorp/[email protected]
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/github "SSH_PRIVATE_KEY" | SSH_PRIVATE_KEY;
kv/data/pypi "USERNAME" | POETRY_HTTP_BASIC_PYPI_USERNAME;
kv/data/pypi "PASSWORD" | POETRY_HTTP_BASIC_PYPI_PASSWORD;
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Setup caching
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
.ext
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum', 'Depfile') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: |
mkdir -p $HOME/.ssh
umask 0077 && echo -e "${SSH_PRIVATE_KEY}" > $HOME/.ssh/id_rsa
ssh-keyscan github.com >> $HOME/.ssh/known_hosts
git config --global url."[email protected]:".insteadOf https://github.com/
git config --global user.email "[email protected]"
git config --global user.name "Aserto Bot"
eval `ssh-agent`
ssh-add $HOME/.ssh/id_rsa
go run mage.go deps
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Build and push the python package
run: go run mage.go release

- name: Bump to the next version
run: go run mage.go bump patch

- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'Bump to next version'
add: 'pyproject.toml'
push: origin HEAD:main

5 changes: 5 additions & 0 deletions Depfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
go:
sver:
importPath: "github.com/aserto-dev/sver/cmd/sver"
version: "v1.3.13"
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/aserto-dev/python-authorizer

go 1.19

require github.com/magefile/mage v1.14.0
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/magefile/mage v1.14.0 h1:6QDX3g6z1YvJ4olPhT1wksUcSa/V0a1B+pJb73fBjyo=
github.com/magefile/mage v1.14.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
12 changes: 12 additions & 0 deletions mage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//go:build zeroinstall
// +build zeroinstall

package main

import (
"os"

"github.com/magefile/mage/mage"
)

func main() { os.Exit(mage.Main()) }
44 changes: 44 additions & 0 deletions magefiles/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module github.com/aserto-dev/python-authorizer/magefiles

go 1.19

require (
github.com/aserto-dev/mage-loot v0.8.10
github.com/magefile/mage v1.14.0
)

require (
github.com/aserto-dev/clui v0.8.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gitleaks/go-gitdiff v0.7.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/kyokomi/emoji v2.2.4+incompatible // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rs/zerolog v1.25.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.13.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/zricethezav/gitleaks/v8 v8.3.0 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 3bac392

Please sign in to comment.