Merge pull request #4 from akshay5995/expose-headers-cors #9
This file contains hidden or 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
name: Release | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
pull-requests: write | |
issues: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install python-semantic-release | |
- name: Configure git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Run semantic release | |
id: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
semantic-release version | |
semantic-release publish | |
# Get the new version for Docker tagging | |
NEW_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") | |
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
if: steps.release.outputs.NEW_VERSION != '' | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Container Registry | |
if: steps.release.outputs.NEW_VERSION != '' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
if: steps.release.outputs.NEW_VERSION != '' | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/mcp-oauth-gateway | |
tags: | | |
type=semver,pattern={{version}},value=v${{ steps.release.outputs.NEW_VERSION }} | |
type=semver,pattern={{major}}.{{minor}},value=v${{ steps.release.outputs.NEW_VERSION }} | |
type=semver,pattern={{major}},value=v${{ steps.release.outputs.NEW_VERSION }} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and push Docker image | |
if: steps.release.outputs.NEW_VERSION != '' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |