File tree Expand file tree Collapse file tree 4 files changed +92
-14
lines changed
Expand file tree Collapse file tree 4 files changed +92
-14
lines changed Original file line number Diff line number Diff line change 1- name : Tag and publish
1+ name : Publish dev
22on :
33 push :
44 branches :
5- - main
6- jobs :
7- tag :
8- uses : AllenNeuralDynamics/aind-github-actions/.github/workflows/tag.yml@main
9- secrets :
10- SERVICE_TOKEN : ${{ secrets.SERVICE_TOKEN }}
5+ - dev
116
7+ jobs :
128 publish :
139 runs-on : ubuntu-latest
14- needs : tag
1510 steps :
1611 - uses : actions/checkout@v3
17- - name : Pull latest changes
18- run : git pull origin main
1912 - name : Set up Docker Buildx
2013 id : buildx
2114 uses : docker/setup-buildx-action@v2
3225 context : .
3326 push : true
3427 tags : |
35- ghcr.io/allenneuraldynamics/aind-data-asset-indexer:${{ needs.tag.outputs.new_version }}
36- ghcr.io/allenneuraldynamics/aind-data-asset-indexer:latest
28+ ghcr.io/allenneuraldynamics/aind-data-asset-indexer:dev
Original file line number Diff line number Diff line change 1+ name : Tag and publish main
2+ on :
3+ push :
4+ branches :
5+ - main
6+
7+ jobs :
8+ tag_and_publish :
9+ name : Parse version
10+ runs-on : ubuntu-latest
11+ outputs :
12+ pkg_version : ${{ steps.output_version.outputs.pkg_version }}
13+ steps :
14+ - uses : actions/checkout@v3
15+ - name : Get version from file
16+ run : |
17+ pkg_name=$(grep -P 'version = \{attr = .*\}' pyproject.toml | grep -oP '\w+.__version__')
18+ init_file="./src/${pkg_name//.__version__}/__init__.py"
19+ pkg_version=$(grep -Po '[0-9]+\.[0-9]+\.[0-9]+' "$init_file")
20+ echo "docker_tag=$pkg_version" >> "$GITHUB_ENV"
21+ - name : Create git tag
22+ run : |
23+ git tag "v${{ env.docker_tag }}"
24+ - name : Push git tag
25+ run : git push origin "v${{ env.docker_tag }}"
26+ - name : Set up Docker Buildx
27+ id : buildx
28+ uses : docker/setup-buildx-action@v2
29+ - name : Login to Github Packages
30+ uses : docker/login-action@v2
31+ with :
32+ registry : ghcr.io
33+ username : ${{ github.actor }}
34+ password : ${{ secrets.GITHUB_TOKEN }}
35+ - name : Build image and push to GitHub Container Registry
36+ uses : docker/build-push-action@v3
37+ with :
38+ # relative path to the place where source code with Dockerfile is located
39+ context : .
40+ push : true
41+ tags : |
42+ ghcr.io/allenneuraldynamics/aind-data-asset-indexer:${{ env.docker_tag }}
43+ ghcr.io/allenneuraldynamics/aind-data-asset-indexer:latest
Original file line number Diff line number Diff line change 1- name : Lint and run tests
1+ name : Run checks in dev
22
33on :
44 pull_request :
55 branches :
6- - main
6+ - dev
77
88jobs :
99 ci :
Original file line number Diff line number Diff line change 1+ name : Run checks in main and release
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - ' *release*'
7+ - main
8+
9+ jobs :
10+ ci :
11+ runs-on : ubuntu-latest
12+ strategy :
13+ matrix :
14+ python-version : [ '3.8', '3.9', '3.10' ]
15+ steps :
16+ - uses : actions/checkout@v3
17+ - name : Set up Python ${{ matrix.python-version }}
18+ uses : actions/setup-python@v3
19+ with :
20+ python-version : ${{ matrix.python-version }}
21+ - name : Install dependencies
22+ run : |
23+ python -m pip install -e .[dev]
24+ - name : Run linter checks
25+ run : flake8 . && interrogate --verbose .
26+ - name : Run tests and coverage
27+ run : coverage run -m unittest discover && coverage report
28+ verify_version :
29+ runs-on : ubuntu-latest
30+ steps :
31+ - uses : actions/checkout@v3
32+ - name : Check version incremented
33+ run : |
34+ pkg_name=$(grep -P 'version = \{attr = .*\}' pyproject.toml | grep -oP '\w+.__version__')
35+ init_file="./src/${pkg_name//.__version__}/__init__.py"
36+ pkg_version=$(grep -Po '[0-9]+\.[0-9]+\.[0-9]+' "$init_file")
37+ latest_tag=$(git ls-remote --tags --refs --sort="v:refname" | tail -n1 | sed 's/.*\///')
38+ echo "Checking pkg_version v$pkg_version and latest_tag $latest_tag"
39+ if [ "$latest_tag" == "v$pkg_version" ]
40+ then
41+ exit 1
42+ fi
43+ echo "Versions are different"
You can’t perform that action at this time.
0 commit comments