Release CI/CD #34
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 CI/CD | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: 'Version bump type (major, minor, patch)' | |
| required: true | |
| default: 'patch' | |
| permissions: | |
| contents: write # ✅ Required to push tags and branches | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_version: ${{ steps.export.outputs.new_version }} | |
| docker_version: ${{ steps.export.outputs.docker_version }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Fetch all tags | |
| - name: Set up Git | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "github-actions@github.com" | |
| - name: Bump Version and Create Tag/Branch | |
| id: export | |
| run: | | |
| chmod +x docker/scripts/bump-version.sh | |
| ./docker/scripts/bump-version.sh ${{ github.event.inputs.version_type }} | |
| build-docker: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Log into Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: true | |
| no-cache: true | |
| tags: | | |
| ${{ secrets.DOCKER_USERNAME }}/airflow-copilot:${{ needs.release.outputs.docker_version}} | |
| ${{ secrets.DOCKER_USERNAME }}/airflow-copilot:latest | |
| deploy-docs: | |
| needs: build-docker | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Install MkDocs | |
| run: | | |
| pip install --upgrade pip | |
| pip install mkdocs mkdocs-material mkdocs-mermaid2-plugin pymdown-extensions | |
| - name: Build MkDocs Site | |
| run: mkdocs build | |
| - name: Publish Docs to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./site | |
| enable_jekyll: false | |
| publish_branch: gh-pages | |
| cname: airflow-copilot.thedatacarpenter.com | |
| create-release: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.release.outputs.new_version }} | |
| name: Release ${{ needs.release.outputs.new_version }} | |
| body: | | |
| 🚀 New version released automatically via CI/CD. | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |