v0.2.1 #12
Workflow file for this run
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
# This workflow will publish the release to Docker Hub | |
name: Publish Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
name: 🏗️ Build Release | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
if: github.repository == 'apptastic-software/trading-calendar' | |
steps: | |
- name: Checkout repository ⚙️ | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Version number 🔢 | |
run: | | |
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3 | cut -c2-) | |
echo "New version: ${NEW_VERSION}" | |
echo "new_version=${NEW_VERSION}" >> $GITHUB_ENV | |
- name: Bump version 🖊️ | |
uses: kurt-code/[email protected] | |
id: read-properties | |
with: | |
operation: 'write' | |
file-path: 'trading_calendar/__init__.py' | |
key-value-pairs: '{"__version__": "\"${{ env.new_version }}\""}' | |
- name: Commit version update 🔀 | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
id: auto-commit-action-bump-version | |
with: | |
commit_message: Bump version to ${{ env.new_version }} | |
file_pattern: trading_calendar/__init__.py | |
branch: main | |
- name: "Version - changes have been detected 🔍" | |
if: steps.auto-commit-action-bump-version.outputs.changes_detected == 'true' | |
run: echo "Updated trading_calendar/__init__.py with version ${{ env.new_version }} ✅" | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install dependencies ⚙️ | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Build and test 🏗️ | |
run: | | |
pip install httpx pytest pytest-cov coverage codecov | |
pytest -v --doctest-modules --junitxml=junit/test-results.xml --cov=trading_calendar --cov-report=xml --cov-report=html | |
documentation: | |
name: 📚 Publish API doc | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository ⚙️ | |
uses: actions/checkout@v4 | |
- name: Version number 🔢 | |
run: | | |
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3 | cut -c2-) | |
echo "New version: ${NEW_VERSION}" | |
echo "new_version=${NEW_VERSION}" >> $GITHUB_ENV | |
- name: Version in __init__.py 🔢 | |
run: | | |
cat trading_calendar/__init__.py | |
echo "__version__=\"${{ env.new_version }}\"" > trading_calendar/__init__.py | |
cat trading_calendar/__init__.py | |
- name: Generate OpenAPI specification 📝 | |
uses: column-st/[email protected] | |
with: | |
moduleDir: trading_calendar | |
outputExtension: json | |
- name: Generate API doc 📝 | |
uses: seeebiii/redoc-cli-github-action@v10 | |
with: | |
args: 'bundle openapi.json -o docs/api-doc/index.html' | |
- name: Deploy latest API doc 📚 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: docs/api-doc | |
target-folder: api-doc/latest | |
commit-message: Publishing ${{ env.new_version }} API doc | |
clean: true | |
dry-run: false | |
- name: Deploy API doc 📚 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: docs/api-doc | |
target-folder: api-doc/${{ env.new_version }} | |
commit-message: Publishing API doc | |
clean: true | |
dry-run: false | |
publish-release: | |
needs: [build] | |
name: 🚀 Publish Release | |
permissions: | |
contents: write | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository ⚙️ | |
uses: actions/checkout@v4 | |
- name: Version number 🔢 | |
run: | | |
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3 | cut -c2-) | |
echo "New version: ${NEW_VERSION}" | |
echo "new_version=${NEW_VERSION}" >> $GITHUB_ENV | |
- name: Version in __init__.py 🔢 | |
run: | | |
cat trading_calendar/__init__.py | |
echo "__version__=\"${{ env.new_version }}\"" > trading_calendar/__init__.py | |
cat trading_calendar/__init__.py | |
- name: Set up QEMU ⚙️ | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx ⚙️ | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub 🔐 | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push 🚀 | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: apptasticsoftware/trading-calendar:${{ env.new_version }}, apptasticsoftware/trading-calendar:latest |