sero/.github/workflows/release.yml
Dmitry Miasnenko a86f6ba0e7
Release 0.2.6 (#24)
* Added docker-compose for dev. Added dev build build and push job for dockerhub

* Moved cors layer to check if /api now is not guarded

* Added logging for error in response

* Removed too strict validation rules for credentials

* fix: x-subdmain was overwritten on correct request. Updated nginx-template and nginx now waits for server

* proxy-fix: New nginx config as the previous one failed with subdomain

* archive-fix: Remove skipping first component in path of entry. Zip archive should not containt root folder.

* assets-fix: Remove root folder inside zips to pass tests. The root dir is not skipped now due to previous commit

* tests-fix: enable logging to see error message in gh actions. Lokal tests work fine

* fmt: for tests

* tests-fix: disable logging to see error message in gh actions. That was gh issue

* fmt: remove unused import

* openapi-client: add build and publih with gh actions

* fix-deploy: nginx now waits for server in dev also

* fix-deploy: publsh to pypi
2024-08-06 00:12:03 +03:00

156 lines
4.2 KiB
YAML

name: "Release"
permissions:
contents: "write"
on:
workflow_run:
workflows: ["Tag"]
types:
- "completed"
jobs:
get-tag:
name: "Get tag version from Cargo.toml"
runs-on: "ubuntu-latest"
outputs:
pkg-version: ${{ steps.pkg-version.outputs.PKG_VERSION }}
steps:
- name: "Check out the repo"
uses: actions/checkout@v3
with:
token: ${{ secrets.G_TOKEN }}
- name: "Get tag"
id: "pkg-version"
shell: "bash"
run: |
echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml) >> $GITHUB_OUTPUT
create-release:
name: "Create release"
if: ${{ github.event.workflow_run.conclusion == 'success' }}
needs:
- "get-tag"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: actions/checkout@v3
- name: "Create release"
uses: "taiki-e/create-gh-release-action@v1"
with:
# (optional) Path to changelog.
# changelog: CHANGELOG.md
branch: "master"
ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }}
token: ${{ secrets.G_TOKEN }}
upload-assets:
name: "Upload assets to Github releases"
if: ${{ github.event.workflow_run.conclusion == 'success' }}
needs:
- "get-tag"
- "create-release"
strategy:
matrix:
include:
- target: "x86_64-unknown-linux-gnu"
os: "ubuntu-latest"
runs-on: ${{ matrix.os }}
steps:
- name: "Check out the repo"
uses: actions/checkout@v3
- name: "Upload Binaries"
uses: "taiki-e/upload-rust-binary-action@v1"
with:
bin: "sero"
target: ${{ matrix.target }}
archive: $bin-${{ matrix.target }}
ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }}
token: ${{ secrets.G_TOKEN }}
push-to-registry:
name: "Build and push Docker image to Docker Hub"
if: ${{ github.event.workflow_run.conclusion == 'success' }}
needs:
- "get-tag"
- "upload-assets"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: actions/checkout@v3
- name: "Log in to Docker Hub"
uses: "docker/login-action@v2"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: "Extract metadata (tags, labels) for Docker"
id: "meta"
uses: "docker/metadata-action@v4"
with:
images: "bwks/shazam"
- name: "Build and push Docker image"
uses: "docker/build-push-action@v3"
with:
context: .
push: true
tags: clowzed/sero:v${{ needs.get-tag.outputs.pkg-version }}
labels: ${{ steps.meta.outputs.labels }}
upload-openapi-client:
needs:
- "push-to-registry"
name: "Build and upload openapi python client"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Install OpenAPI Generator CLI
run: |
npm install @openapitools/openapi-generator-cli -g
- name: Extract version from OpenAPI spec
id: extract_version
run: |
VERSION=$(jq -r '.info.version' openapi.json)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Generate Python client from OpenAPI spec
run: |
openapi-generator-cli generate -i openapi.json -g python -o seroapi --additional-properties=packageName=seroapi,packageVersion=${{ env.VERSION }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Configure Poetry
run: |
poetry config virtualenvs.in-project true
- name: Install dependencies
run: |
cd seroapi
poetry install
- name: Publish to Test PyPI
run: |
cd seroapi
poetry publish -u __token__ -p ${{ secrets.PYPI_PASSWORD }} --build