Skip to content

Commit

Permalink
publish
Browse files Browse the repository at this point in the history
  • Loading branch information
minggong-svg committed Aug 25, 2024
1 parent bc8ecde commit e6172e4
Show file tree
Hide file tree
Showing 186 changed files with 1,151 additions and 2 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# .github/workflows/release.yaml

name: Release

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Poetry and Packages
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry install
- name: Determine Version Change
id: version_check
run: |
VERSION="v$(poetry version -s)"
echo "Current version: $VERSION"
LATEST_RELEASE=$(curl -s -H "Authorization: token ${{ github.token }}" \
https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
echo "Latest release version: $LATEST_RELEASE"
if [ "$VERSION" != "$LATEST_RELEASE" ]; then
echo "Version has changed."
echo "version_changed=true" >> $GITHUB_OUTPUT
echo "new_version=$VERSION" >> $GITHUB_OUTPUT
else
echo "No version change detected."
echo "version_changed=false" >> $GITHUB_OUTPUT
fi
- name: Create Release
if: steps.version_check.outputs.version_changed == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version_check.outputs.new_version }}
generate_release_notes: True

- name: mint API token
if: steps.version_check.outputs.version_changed == 'true'
id: mint-token
run: |
# retrieve the ambient OIDC token
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi")
oidc_token=$(jq -r '.value' <<< "${resp}")
# exchange the OIDC token for an API token
resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}")
api_token=$(jq -r '.token' <<< "${resp}")
# mask the newly minted API token, so that we don't accidentally leak it
echo "::add-mask::${api_token}"
# see the next step in the workflow for an example of using this step output
echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
- name: Build and publish to PyPI
if: steps.version_check.outputs.version_changed == 'true'
run: |
poetry build
poetry publish -u __token__ -p ${{ steps.mint-token.outputs.api-token }}
Binary file not shown.
File renamed without changes.
4 changes: 2 additions & 2 deletions controller/main.py → kspec_gfa_controller/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ async def main():
camnum = [4, 6]
# ping()
# status()
# cam_params()
await grab()
cam_params(4)
# await grab()


if __name__ == "__main__":
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.

Large diffs are not rendered by default.

855 changes: 855 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tool.poetry]
name = "kspec-gfa-controller"
version = "0.6.0"
description = "The Controller software for KSPEC-GFA Camera"
authors = ["Mingyeong Yang <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
logging = "^0.4.9.6"
astropy = "^6.1.2"
datetime = "^5.5"
asyncio = "^3.4.3"
pypylon = "^4.0.0"


[tool.poetry.group.dev.dependencies]
matplotlib = "^3.9.2"
ruff = "^0.6.2"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit e6172e4

Please sign in to comment.