Skip to content

Release new client based on OpenAPI Specification Update - 2024-08-28 #13

Release new client based on OpenAPI Specification Update - 2024-08-28

Release new client based on OpenAPI Specification Update - 2024-08-28 #13

Workflow file for this run

name: "Check if the package is ready for publishing"
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
debug_if:
runs-on: ubuntu-latest
steps:
- run: |
echo "head_ref: ${{ github.head_ref }}"
echo "base_ref: ${{ github.base_ref }}"
echo "ref_name: ${{ github.ref_name }}"
echo "GITHUB_REF: $GITHUB_REF"
echo "GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "GITHUB_REF_PROTECTED: $GITHUB_REF_PROTECTED"
echo "GITHUB_REF_TYPE: $GITHUB_REF_TYPE"
echo "GITHUB_HEAD_REF: $GITHUB_HEAD_REF"
echo "GITHUB_BASE_REF: $GITHUB_BASE_REF"
echo "GITHUB_WORKFLOW_REF: $GITHUB_WORKFLOW_REF"
echo "show current: $(git branch --show-current)"
echo "is_release: ${{ startsWith(github.head_ref, 'release/') }}"
check_publish:
if: startsWith(github.head_ref, 'release/')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get last version tag
id: last_version
run: |
echo "LAST_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Check if version is updated in pubspec.yaml
id: check_version
run: |
# Check if the version in pubspec.yaml is the same as the last version tag
if [[ $(grep -c "version: ${{ steps.last_version.outputs.LAST_VERSION }}" pubspec.yaml) -eq 1 ]]; then
echo "Please bump the version in pubspec.yaml"
exit 1
fi
- name: Check if CHANGELOG.md contains the new version
id: check_changelog
run: |
# grep finds the line with the version in pubspec.yaml and awk extracts the version number
NEW_VERSION=$(grep "version: " pubspec.yaml | awk '{print $2}')
# Check if the new version is in CHANGELOG.md
# The version should be in format '## x.y.z'
if ! grep -q "## $NEW_VERSION" CHANGELOG.md; then
echo "CHANGELOG.md does not contain the new version: $NEW_VERSION. Please add changelog entry."
exit 1
fi
- name: Check openapi_specs/openapi-modified.yaml has changed
id: check_changes
run: |
if git diff --exit-code openapi_specs/openapi-modified.yaml; then
echo "No changes detected in openapi-modified.yaml. Please update the OpenAPI specification based on openapi_specs/openapi-original.yaml"
exit 1 # Exit with non-zero status to fail the step
else
echo "Changes detected in openapi-modified.yaml."
fi
- name: Pub publish dry run
run: dart pub publish --dry-run