Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 0 additions & 156 deletions .circleci/config.yml

This file was deleted.

62 changes: 57 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,35 @@ on:
- "v*"

permissions:
id-token: write
contents: write
id-token: write
contents: write

jobs:
# Build and publish to GitHub, Cloudsmith (zipapp + Docker)
build:
name: Build and publish artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install shiv

- name: Get version
id: get_version
run: echo "VERSION=$(cat cloudsmith_cli/data/VERSION)" >> $GITHUB_ENV

- name: Create Zipapp
run: shiv -o cloudsmith-${{ env.VERSION }}.pyz -c cloudsmith .

- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -36,6 +45,7 @@ jobs:
release_name: Release v${{ env.VERSION }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
Expand All @@ -46,26 +56,68 @@ jobs:
asset_path: ./cloudsmith-${{ env.VERSION }}.pyz
asset_name: cloudsmith-${{ env.VERSION }}.pyz
asset_content_type: application/zip

- name: Install and authenticate Cloudsmith CLI
uses: cloudsmith-io/cloudsmith-cli-action@v1.0.3
uses: cloudsmith-io/cloudsmith-cli-action@v1
with:
oidc-namespace: ${{ vars.CLOUDSMITH_NAMESPACE }}
oidc-service-slug: ${{ vars.CLOUDSMITH_SVC_SLUG }}

- name: Push Zipapp to Cloudsmith
id: push_zipapp
run: cloudsmith push raw ${{ vars.CLOUDSMITH_NAMESPACE }}/cli-zipapp ./cloudsmith-${{ env.VERSION }}.pyz --name cloudsmith-cli --version ${{ env.VERSION }}

- name: Install build dependencies for Python packages
run: pip install setuptools wheel

- name: Build Python packages
run: python setup.py sdist bdist_wheel

- name: Push source distribution to Cloudsmith
run: cloudsmith push python ${{ vars.CLOUDSMITH_NAMESPACE }}/cli dist/cloudsmith-cli-${{ env.VERSION }}.tar.gz

- name: Push wheel to Cloudsmith
run: cloudsmith push python ${{ vars.CLOUDSMITH_NAMESPACE }}/cli dist/cloudsmith_cli-${{ env.VERSION }}-py3-none-any.whl

- name: Build Docker image
id: build_cli_image
run: |
docker build --build-arg CLOUDSMITH_CLI_VERSION=${{ env.VERSION }} -t docker.cloudsmith.io/${{ vars.CLOUDSMITH_NAMESPACE }}/cli-zipapp/cloudsmith-cli:${{ env.VERSION }} .

- name: Push Dockerised CLI to Cloudsmith
id: push_dockerised_cli_cloudsmith
run: |
echo "${CLOUDSMITH_API_KEY}" | docker login docker.cloudsmith.io -u ${{ vars.CLOUDSMITH_SVC_SLUG }} --password-stdin
docker push docker.cloudsmith.io/${{ vars.CLOUDSMITH_NAMESPACE }}/cli-zipapp/cloudsmith-cli:${{ env.VERSION }}

- name: Push Dockerised CLI to DockerHub
id: push_dockerised_cli_dockerhub
run: |
docker tag docker.cloudsmith.io/${{ vars.CLOUDSMITH_NAMESPACE }}/cli-zipapp/cloudsmith-cli:${{ env.VERSION }} cloudsmith/cloudsmith-cli:${{ env.VERSION }}
echo "${{ secrets.DOCKERHUB_PAT }}" | docker login -u ${{ vars.DOCKERHUB_USER }} --password-stdin
docker push cloudsmith/cloudsmith-cli:${{ env.VERSION }}

# Publish Python packages to PyPI
publish-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel

- name: Build packages
run: python setup.py sdist bdist_wheel

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
Loading