diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 825ed65..2496b64 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -7,8 +7,8 @@ on: workflow_call: jobs: - build: - name: Build + build-docs: + name: Build Documentation runs-on: ubuntu-latest diff --git a/.github/workflows/autoformat-and-lint.yml b/.github/workflows/code-quality.yml similarity index 57% rename from .github/workflows/autoformat-and-lint.yml rename to .github/workflows/code-quality.yml index afccb3b..9261907 100644 --- a/.github/workflows/autoformat-and-lint.yml +++ b/.github/workflows/code-quality.yml @@ -1,15 +1,14 @@ -name: Auto Format and Lint +name: Code Quality on: pull_request: push: branches: - main - merge_group: jobs: - autoformat-and-lint: - name: Auto Format and Lint + static-analysis: + name: Static Analysis if: github.actor != 'dependabot[bot]' runs-on: ubuntu-latest permissions: @@ -22,27 +21,39 @@ jobs: ref: ${{ github.head_ref }} token: ${{ secrets.WORKFLOW_COMMIT }} - - name: ๐Ÿ Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.13" - cache: "pip" - - name: ๐Ÿ“ฆ Install Hatch uses: pypa/hatch@install - name: ๐Ÿ“ Format Code - run: hatch fmt -f + run: hatch fmt - - name: โœ… Commit code format changes + - name: โœ… Commit Code Format Changes uses: stefanzweifel/git-auto-commit-action@v5 with: - commit_message: "Auto format code" + commit_message: "Hatch static analysis" skip_fetch: true skip_checkout: true + + type-check: + name: Type Check + if: github.actor != 'dependabot[bot]' + runs-on: ubuntu-latest + + steps: + - name: ๐Ÿ›Ž Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.WORKFLOW_COMMIT }} - - name: ๐Ÿงถ Lint - run: hatch fmt --check + - name: ๐Ÿ Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + cache: "pip" + + - name: ๐Ÿ“ฆ Install Hatch + uses: pypa/hatch@install - name: ๐Ÿ” Type Check - run: hatch run check \ No newline at end of file + run: hatch run check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..eedebd5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,79 @@ +name: Release Version + +on: + push: + tags: + - "v*" + +jobs: + # Publish Python package to PyPI. + publish-to-pypi: + name: Publish to PyPI + + runs-on: ubuntu-latest + + environment: + name: pypi + url: https://pypi.org/p/ephys-link + + permissions: + id-token: write + + steps: + - name: ๐Ÿ›Ž Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: ๐Ÿ Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + cache: "pip" + + - name: ๐Ÿ“ฆ Install Hatch + uses: pypa/hatch@install + + - name: ๐Ÿ”จ Build Package + run: hatch build + + - name: ๐Ÿ“ฆ Publish Distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + # Build Windows executable and make release. + build-and-release: + name: Build Executable and Release + + runs-on: windows-latest + + steps: + - name: ๐Ÿ›Ž Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: ๐Ÿ Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + cache: "pip" + + - name: ๐Ÿ“ฆ Install Hatch + uses: pypa/hatch@install + + - name: ๐Ÿ”จ Build Executable + run: hatch run exe + + - name: ๐Ÿค Zip Build Folder + # FIXME: Need correct CLI with correct folder name. + run: Compress-Archive -Path dist/ephys-link-${{ github.ref_name }} -Destination dist/ephys-link-${{ github.ref_name }}.zip + + - name: ๐Ÿ“ฆ Make Release + uses: ncipollo/release-action@v1 + with: + tag: ${{ github.ref_name }} + # FIXME: Use correct name. + artifacts: "dist/ephys-link-${{ github.ref_name }}.zip,dist/ephys-link-${{ github.ref_name }}.exe" + artifactErrorsFailBuild: true + generateReleaseNotes: true + prerelease: ${{ contains(github.ref_name, "a") || contains(github.ref_name, "b") || contains(github.ref_name, "c") || contains(github.ref_name, "d") }}