Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish action #35

Merged
merged 15 commits into from
Nov 4, 2024
Merged
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
10 changes: 9 additions & 1 deletion .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Publish Docker image

on:
workflow_dispatch:
workflow_call:
inputs:
tag:
type: string
required: true

env:
REGISTRY: ghcr.io
Expand Down Expand Up @@ -36,6 +40,10 @@ jobs:
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=true
tags: |
type=raw,value=${{ inputs.tag }}

- name: Build and push Docker image
id: push
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Build documentation
name: Publish documentation

on:
workflow_dispatch:

permissions:
id-token: write
contents: read
workflow_call:

env:
INSTANCE: 'Writerside/cd'
Expand Down Expand Up @@ -55,7 +51,10 @@ jobs:
deploy:
env:
AWS_REGION: 'us-east-1'
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BRANCH_NAME: main
permissions:
contents: read
id-token: write
needs:
- build
- test
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/publish-pip-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish Pip Package

on:
workflow_call:
inputs:
tag:
type: string
required: true

env:
app-name: "chronovoyage"

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

- name: Download assets
uses: robinraju/release-downloader@v1
with:
tag: ${{ inputs.tag }}
fileName: ${{ env.app-name }}-*
out-file-path: dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
47 changes: 32 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
name: Publish to PyPI

on:
workflow_dispatch:
release:
types:
- published

permissions:
contents: read
env:
app-name: "chronovoyage"

jobs:
publish:
check-tag-name-exists:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
if: ${{ github.event.release.tag_name != '' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: "true"

- name: Install Hatch
uses: pypa/hatch@install
publish-pip-package:
needs: check-tag-name-exists
uses: ./.github/workflows/publish-pip-package.yml
with:
tag: ${{ github.event.release.tag_name }}
permissions:
contents: read
id-token: write

- name: Build Package
run: hatch build -c
publish-docker-image:
needs: check-tag-name-exists
uses: ./.github/workflows/publish-docker-image.yml
with:
tag: ${{ github.event.release.tag_name }}
permissions:
contents: read
packages: write
attestations: write
id-token: write

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-docs:
needs: check-tag-name-exists
uses: ./.github/workflows/publish-docs.yml
permissions:
contents: read
id-token: write