-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e886db
commit 6cba5be
Showing
1 changed file
with
92 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,99 @@ | ||
name: 🎯 Release | ||
name: 🤖 Publish Package | ||
|
||
on: | ||
release: | ||
types: [ "released" ] | ||
|
||
env: | ||
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/keystone-api | ||
workflow_call: | ||
inputs: | ||
version: | ||
description: 'Set the version number of the published application.' | ||
default: '0.0.0' | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
version: | ||
name: Get Release Version | ||
publish-docker: | ||
runs-on: ubuntu-latest | ||
name: Docker Image | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
- name: Fetch image artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: keystone-api-docker | ||
path: /tmp | ||
|
||
- name: Load image | ||
run: docker load --input /tmp/keystone-api.tar | ||
|
||
- name: Define Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository_owner }}/keystone-api | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=raw,value=latest | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
publish-pypi: | ||
name: Python Distribution | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.get_version.outputs.version }} | ||
|
||
steps: | ||
- name: Determine version from release tag | ||
id: get_version | ||
run: | | ||
release_tag=${{github.ref}} | ||
version="${release_tag#refs/tags/v}" | ||
echo "version=$version" >> "$GITHUB_OUTPUT" | ||
build: | ||
name: Build | ||
needs: version | ||
uses: ./.github/workflows/Build.yml | ||
with: | ||
version: ${{needs.version.outputs.version}} | ||
|
||
test: | ||
name: Test | ||
needs: build | ||
uses: ./.github/workflows/Test.yml | ||
|
||
publish: | ||
name: Publish | ||
needs: [ version, test ] | ||
uses: ./.github/workflows/Publish.yml | ||
secrets: inherit | ||
with: | ||
version: ${{needs.version.outputs.version}} | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: false | ||
|
||
- name: Fetch build artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: keystone-api-python | ||
path: dist | ||
|
||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
print-hash: true | ||
user: ${{ secrets.REPO_USER }} | ||
password: ${{ secrets.REPO_PASSWORD }} | ||
|
||
trigger-docs: | ||
name: Trigger Docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update docs | ||
uses: pitt-crc/keystone-docs/.github/actions/update-action/@main | ||
with: | ||
keystone-gitops-id: ${{ secrets.KEYSTONE_GITOPS_ID }} | ||
keystone-gitops-pk: ${{ secrets.KEYSTONE_GITOPS_PK }} | ||
repo-name: keystone-api | ||
tag: v${{ inputs.version }} |