Skip to content

cd

cd #9

Workflow file for this run

---
## continuous deployment workflow
name: cd
on:
# push:
# branches:
# - main
workflow_dispatch:
permissions:
contents: read
jobs:
# lint:
# name: Run linting
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# fetch-tags: false
# ref: ${{ github.sha || 'main' }}
# - uses: actions/setup-python@v5
# with:
# python-version-file: .python-version
# cache-dependency-path: pyproject.toml
# - name: Lint
# run: make lint
# test-python:
# runs-on: ubuntu-latest
# needs: lint
# strategy:
# matrix:
# python-version: ["3.9", "3.10", "3.11", "3.12"]
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# fetch-tags: false
# ref: ${{ github.sha || 'main' }}
# - uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python-version }}
# cache-dependency-path: pyproject.toml
# - name: test
# run: make test
# - name: it-test
# run: make it-test
release:
runs-on: ubuntu-latest
# needs: [lint, test-python]
permissions:
# write permission is required to create a github release
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
ref: ${{ github.sha || 'main' }}
- uses: actions/setup-python@v5
with:
python-version-file: .python-version
cache-dependency-path: pyproject.toml
- name: Check version change
uses: actions/github-script@v7
id: check_version
with:
script: |
const fs = require('fs');
const version = fs.readFileSync('src/pytest_otel/__init__.py', 'utf8').match(/__version__ = (.*)/)[1].trim();
const { data: latestRelease } = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo,
})
if (latestRelease.tag_name === 'v${version}' ) {
core.setOutput('release', 'false' );
} else {
core.setOutput('release', 'true' );
core.setOutput('version', version );
}
core.info(`version: ${version}`);
core.info(`latestRelease: ${latestRelease.tag_name}`);
# - name: Release
# if: ${{ steps.check_version.outputs.release == 'true'}}
# id: release
# run: make publish
# env:
# TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
# REPO_URL: ${{ secrets.REPO_URL }}
# - uses: release-drafter/release-drafter@v6
# if: ${{ steps.check_version.outputs.release == 'true'}}
# with:
# version: ${{ steps.release.outputs.version }}
# publish: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}