Skip to content

feat(api): Add a new API for exporting data as a CSV #18

feat(api): Add a new API for exporting data as a CSV

feat(api): Add a new API for exporting data as a CSV #18

Workflow file for this run

name: Release
on:
pull_request:
branches:
- main
types:
- closed
paths: [src/**/*, main.py, requirements.txt, Dockerfile]
env:
PR_NUMBER: pr${{ github.event.number }}
jobs:
push:
name: Push Docker images
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
actions: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Dry run for Git tag
id: git_tag
uses: anothrNick/[email protected]
env:
DRY_RUN: true
DEFAULT_BUMP: patch
WITH_V: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare job outputs
id: op
run: |
echo "date=$(date +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
echo "app_version=$(sed "s/^v//" <<< ${{ steps.git_tag.outputs.tag }})" >> "$GITHUB_OUTPUT"
- name: Download artifact
uses: dawidd6/action-download-artifact@v3
with:
name: ${{ github.event.repository.name }}-${{ env.PR_NUMBER }}
path: /tmp
workflow: build.yml
- name: Load image
run: |
docker load --input /tmp/${{ github.event.repository.name }}-${{ env.PR_NUMBER }}.tar
docker tag ${{ github.repository }}:${{ env.PR_NUMBER }} ${{ github.repository }}:${{ steps.git_tag.outputs.tag }}
docker tag ${{ github.repository }}:${{ env.PR_NUMBER }} ghcr.io/${{ github.repository }}:${{ steps.git_tag.outputs.tag }}
- name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to the GH Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker images to DockerHub
run: |
docker push docker.io/${{ github.repository }}:${{ steps.git_tag.outputs.tag }}
docker push docker.io/${{ github.repository }}:latest
- name: Push Docker images to GH Container registry
run: |
docker push ghcr.io/${{ github.repository }}:${{ steps.git_tag.outputs.tag }}
docker push ghcr.io/${{ github.repository }}:latest
outputs:
gitTag: ${{ steps.git_tag.outputs.tag }}
appVersion: ${{ steps.op.outputs.app_version }}
date: ${{ steps.op.outputs.date }}
bump:
name: Bump version
runs-on: ubuntu-latest
permissions:
packages: read
contents: write
needs: [push]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Create Git tag
id: git_tag
uses: anothrNick/[email protected]
env:
DEFAULT_BUMP: patch
RELEASE_BRANCHES: main
WITH_V: true
PRERELEASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Publish release
runs-on: ubuntu-latest
needs: [push, bump]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish release
uses: ncipollo/[email protected]
with:
tag: ${{ needs.push.outputs.gitTag }}
name: ${{ needs.push.outputs.appVersion }} / ${{ needs.push.outputs.date }}
bodyFile: CHANGELOG.md
documentation:
name: Publish API documentation
runs-on: ubuntu-latest
needs: [push, bump]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Start project with Docker Compose
run: |
cd docs/examples/docker && docker compose up -d
sleep 10
- name: Build Redocly page
uses: seeebiii/redoc-cli-github-action@v10
with:
args: bundle http://172.17.0.1:5000/openapi.json -o redoc/index.html
- name: Publish GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
allow_empty_commit: true
enable_jekyll: true
publish_dir: ./redoc
keep_files: true