release #7
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" | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| image_tag: | |
| description: "Docker Image Tag" | |
| required: false | |
| default: "dev" | |
| jobs: | |
| docker-build: | |
| runs-on: ubuntu-latest-public-m | |
| steps: | |
| - name: Clear Space | |
| run: | | |
| rm -rf /usr/share/dotnet | |
| rm -rf /opt/ghc | |
| rm -rf "/usr/local/share/boost" | |
| rm -rf "$AGENT_TOOLSDIRECTORY" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| # Determine tags | |
| - name: Generate tags | |
| id: tags | |
| run: | | |
| BASE_TAG="${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}" | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| # For releases: tag with version AND latest | |
| echo "tags=${BASE_TAG}:${{ github.event.release.tag_name }},${BASE_TAG}:latest" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| # For manual dispatch: use provided tag | |
| echo "tags=${BASE_TAG}:${{ github.event.inputs.image_tag }}" >> $GITHUB_OUTPUT | |
| else | |
| # For main branch: dev tag only | |
| echo "tags=${BASE_TAG}:dev" >> $GITHUB_OUTPUT | |
| fi | |
| # Build and push step | |
| - name: Build and push | |
| uses: docker/build-push-action@v4 | |
| with: | |
| push: true | |
| file: ./Dockerfile | |
| tags: ${{ steps.tags.outputs.tags }} | |
| validate-build: | |
| needs: docker-build | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'release' # Skip validation for releases | |
| steps: | |
| # Checkout | |
| - uses: actions/checkout@v4 | |
| # Basic validation - check if image was pushed successfully | |
| - name: Validate Image | |
| run: | | |
| echo "✅ Docker image built and pushed successfully" | |
| echo "Image: ${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}:${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && github.event.inputs.image_tag) || 'dev' }}" | |
| echo "🎯 Pod deployment ready for testing" |