Skip to content

Commit a94e726

Browse files
author
Thinh Nguyen
committed
set up release processes for GH Action
1 parent b991fbb commit a94e726

File tree

4 files changed

+124
-2
lines changed

4 files changed

+124
-2
lines changed

.github/workflows/development.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Development
2+
on:
3+
pull_request:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
jobs:
8+
publish-release:
9+
if: github.event_name == 'push'
10+
needs: test
11+
runs-on: ubuntu-latest
12+
env:
13+
TWINE_USERNAME: ${{secrets.twine_username}}
14+
TWINE_PASSWORD: ${{secrets.twine_password}}
15+
outputs:
16+
release_upload_url: ${{steps.create_gh_release.outputs.upload_url}}
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Determine package version
20+
run: |
21+
PKG_NAME=$(cat setup.py | awk -F\' '/pkg_name = / {print $2}')
22+
PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\' '/__version__ = / {print $2}')
23+
echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV
24+
echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV
25+
- name: Get changelog entry
26+
id: changelog_reader
27+
uses: guzman-raphael/changelog-reader-action@v5
28+
with:
29+
path: ./CHANGELOG.md
30+
version: ${{env.PKG_VERSION}}
31+
- name: Create GH release
32+
id: create_gh_release
33+
uses: actions/create-release@v1
34+
env:
35+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
36+
with:
37+
tag_name: ${{steps.changelog_reader.outputs.version}}
38+
release_name: Release ${{steps.changelog_reader.outputs.version}}
39+
body: ${{steps.changelog_reader.outputs.changes}}
40+
prerelease: ${{steps.changelog_reader.outputs.status == 'prereleased'}}
41+
draft: ${{steps.changelog_reader.outputs.status == 'unreleased'}}
42+
- name: Fetch image artifact
43+
uses: actions/download-artifact@v2
44+
with:
45+
name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py3.8-alpine
46+
- name: Fetch pip artifacts
47+
uses: actions/download-artifact@v2
48+
with:
49+
name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}}
50+
path: dist
51+
- name: Publish pip release
52+
run: |
53+
export HOST_UID=$(id -u)
54+
docker load < "image-${{env.PKG_NAME}}-${PKG_VERSION}-py3.8-alpine.tar.gz"
55+
docker-compose -f docker-compose-build.yaml run \
56+
-e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} ${PKG_NAME} \
57+
sh -lc "pip install twine && python -m twine upload dist/*"
58+
- name: Determine pip artifact paths
59+
run: |
60+
echo "PKG_WHEEL_PATH=$(ls dist/${PKG_NAME}-*.whl)" >> $GITHUB_ENV
61+
echo "PKG_SDIST_PATH=$(ls dist/${PKG_NAME}-*.tar.gz)" >> $GITHUB_ENV
62+
- name: Upload pip wheel asset to release
63+
uses: actions/upload-release-asset@v1
64+
env:
65+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
66+
with:
67+
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
68+
asset_path: ${{env.PKG_WHEEL_PATH}}
69+
asset_name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}}.whl
70+
asset_content_type: application/zip
71+
- name: Upload pip sdist asset to release
72+
uses: actions/upload-release-asset@v1
73+
env:
74+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
75+
with:
76+
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
77+
asset_path: ${{env.PKG_SDIST_PATH}}
78+
asset_name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}}.tar.gz
79+
asset_content_type: application/gzip

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
44

55
## [0.1.0a2] - 2021-04-16
6-
### Added
7-
6+
### Added
7+
+ `probe` and `ephys` elements
8+
+ Readers for: `SpikeGLX`, `Open Ephys`, `Kilosort`
9+
+ Probe table supporting: Neuropixels probes 1.0 - 3A, 1.0 - 3B, 2.0 - SS, 2.0 - MS
810

911

1012
[0.1.0a2]: https://github.com/datajoint/element-array-ephys/releases/tag/0.1.0a2

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ARG PY_VER
2+
ARG DISTRO
3+
ARG IMAGE
4+
ARG PKG_NAME
5+
ARG PKG_VERSION
6+
7+
FROM datajoint/${IMAGE}:py${PY_VER}-${DISTRO}
8+
COPY --chown=dja:anaconda ./requirements.txt ./setup.py \
9+
/main/
10+
COPY --chown=dja:anaconda ./${PKG_NAME} /main/${PKG_NAME}
11+
RUN \
12+
cd /main && \
13+
pip install . && \
14+
rm -R /main/*
15+
WORKDIR /main

docker-compose-build.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# PY_VER=3.8 IMAGE=djbase DISTRO=alpine PKG_NAME=$(cat setup.py | awk -F\' '/pkg_name = / {print $2}') PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\' '/__version__/ {print $2}') HOST_UID=$(id -u) docker-compose -f docker-compose-build.yaml up --build
2+
#
3+
# Intended for updating dependencies and docker image.
4+
# Used to build release artifacts.
5+
version: "2.4"
6+
services:
7+
element:
8+
build:
9+
context: .
10+
args:
11+
- PY_VER
12+
- DISTRO
13+
- IMAGE
14+
- PKG_NAME
15+
- PKG_VERSION
16+
image: datajoint/${PKG_NAME}:${PKG_VERSION}
17+
user: ${HOST_UID}:anaconda
18+
volumes:
19+
- .:/main
20+
command:
21+
- sh
22+
- -lc
23+
- |
24+
set -e
25+
rm -R build dist *.egg-info || echo "No prev build"
26+
python setup.py bdist_wheel sdist

0 commit comments

Comments
 (0)