Skip to content

Commit 1e8fa3d

Browse files
authored
Merge pull request #31 from k2bd/chore/add-release-actions
Update README and setup release and publication
2 parents e8643cc + 6594015 commit 1e8fa3d

File tree

3 files changed

+95
-2
lines changed

3 files changed

+95
-2
lines changed

.github/workflows/pypi.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Release Package to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Build and publish to pypi
15+
uses: JRubics/[email protected]
16+
with:
17+
pypi_token: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/release.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
bump:
6+
type: choice
7+
description: How to bump the version
8+
required: true
9+
options:
10+
- major
11+
- minor
12+
- patch
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.BOT_ACCESS_TOKEN }}
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.12'
24+
- run: python -m pip install poetry
25+
- run: poetry install --all-extras
26+
- name: Configure git
27+
run: |
28+
git config --global user.name 'Release bot'
29+
git config --global user.email '[email protected]'
30+
git push
31+
- name: bump release version and tag
32+
run: |
33+
poetry version ${{ github.event.inputs.bump }}
34+
export NEW_VERSION=v$(poetry version -s)
35+
git commit -am "Bumping to version $NEW_VERSION"
36+
git tag -a $NEW_VERSION -m $NEW_VERSION
37+
- name: prepatch to the next version
38+
run: |
39+
poetry version prepatch
40+
export NEW_VERSION=v$(poetry version -s)
41+
git commit -am "Prepatching to $NEW_VERSION"
42+
- name: Push results
43+
# See https://www.wearecogworks.com/blog/quick-guide-to-running-sub-workflows-with-github-actions/
44+
run: |
45+
git push "https://$GITHUB_ACTOR:${{ secrets.BOT_ACCESS_TOKEN }}@github.com/$GITHUB_REPOSITORY.git"
46+
git push "https://$GITHUB_ACTOR:${{ secrets.BOT_ACCESS_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" --tags

README.md

+32-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,32 @@
66

77
## N.B. this project is in a pre-release state. There may be breaking changes to all aspects of the tool while some decisions are being made and changed. It is not recommended for use in real projects until the v1.0.0 release. See (TODO milestone) for more info.
88

9-
## Running `flux`
9+
## Adding `flux` to your project
1010

1111
### CLI
1212

13+
``flux`` can be installed for now from Github. For example:
14+
15+
```
16+
poetry add git+https://github.com/k2bd/flux-migrations.git[postgres]
17+
```
18+
19+
The project will be properly maintained on PyPI when it's stable. The PyPI version may therefore not be up-to-date at this time.
20+
21+
``flux`` commands can then be listed with ``flux --help``
22+
23+
For example, migrations can be initialized and started with:
24+
25+
```
26+
flux init postgres
27+
28+
flux new "Initial migration"
29+
```
30+
1331
### Docker
1432

33+
(TODO)
34+
1535
## Writing migrations
1636

1737
## Use as a library
@@ -25,7 +45,17 @@ This can be particularly useful for testing.
2545

2646
### Inbuilt backends
2747

28-
(TODO)
48+
#### Postgres
49+
50+
``flux`` comes packages with a Postgres backend. It maintains information about migrations in a configurable schema and table. Additionally, it uses an advisory lock while migrations are being applied with a configurable index. The available ``[backend]`` configs are:
51+
52+
- ``migrations_schema``
53+
- The schema in which to put the migration history table
54+
- (default "public")
55+
- ``migrations_table`` (default "_flux_migrations")
56+
- The table used for applied migration history
57+
- ``migrations_lock_id`` (default 3589 ('flux' on a phone keypad))
58+
- The ``pg_advisory_lock`` ID to use while applying migrations
2959

3060
### Adding a new backend
3161

0 commit comments

Comments
 (0)