Skip to content

Commit

Permalink
chore: refine CICD of publishing (#1040)
Browse files Browse the repository at this point in the history
  • Loading branch information
WHALEEYE authored Oct 11, 2024
1 parent c1484f5 commit 14abef7
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 54 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/publish_docker_image.yml

This file was deleted.

81 changes: 58 additions & 23 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish camel to PyPI / GitHub
name: Publish CAMEL to PyPI / GitHub

on:
push:
Expand All @@ -8,43 +8,78 @@ on:
workflow_dispatch:

jobs:
build-n-publish:
build-and-publish-pypi:
name: Build and publish to PyPI
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v3
- name: Build and publish to pypi
- name: Checkout code
uses: actions/checkout@v4

- name: Build and publish to PyPI
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_KEY }}
ignore_dev_requirements: "yes"

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get Asset name
run: |
export PKG=$(ls dist/ | grep tar)
set -- $PKG
echo "name=$1" >> $GITHUB_ENV
- name: Upload Release Asset (sdist) to GitHub
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release to GitHub
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
draft: false
prerelease: false
files: |
dist/${{ env.name }}
build-and-publish-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and Push Docker image
uses: docker/build-push-action@v5
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ env.name }}
asset_name: ${{ env.name }}
asset_content_type: application/zip
context: .
file: .container/minimal_build/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
platforms: linux/amd64,linux/arm64
sbom: false
provenance: false
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}

0 comments on commit 14abef7

Please sign in to comment.