fix #2
Workflow file for this run
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: | |
| tags: | |
| - '**/v*.*.*' # Matches tags like evm/single/v0.2.0, testapp/v0.4.0, etc. | |
| permissions: {} | |
| jobs: | |
| parse-tag: | |
| name: Parse Release Tag | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| app-path: ${{ steps.parse.outputs.app-path }} | |
| version: ${{ steps.parse.outputs.version }} | |
| image-name: ${{ steps.parse.outputs.image-name }} | |
| dockerfile: ${{ steps.parse.outputs.dockerfile }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Parse tag and validate app | |
| id: parse | |
| run: | | |
| TAG="${{ github.ref_name }}" | |
| echo "Processing tag: $TAG" | |
| # Extract version (everything after the last /) | |
| VERSION="${TAG##*/}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| # Extract app path (everything before the last /) | |
| APP_PATH="${TAG%/*}" | |
| echo "app-path=$APP_PATH" >> $GITHUB_OUTPUT | |
| # Check if the app directory exists in ./apps/ | |
| if [ ! -d "apps/$APP_PATH" ]; then | |
| echo "::error::App directory 'apps/$APP_PATH' does not exist" | |
| exit 1 | |
| fi | |
| # Check if Dockerfile exists | |
| if [ ! -f "apps/$APP_PATH/Dockerfile" ]; then | |
| echo "::error::Dockerfile not found in 'apps/$APP_PATH/'" | |
| exit 1 | |
| fi | |
| echo "dockerfile=apps/$APP_PATH/Dockerfile" >> $GITHUB_OUTPUT | |
| # Generate image name from app path (replace / with -) | |
| IMAGE_NAME="ev-node-${APP_PATH//\//-}" | |
| echo "image-name=$IMAGE_NAME" >> $GITHUB_OUTPUT | |
| echo "::notice::Building $IMAGE_NAME version $VERSION from apps/$APP_PATH" | |
| build-and-push: | |
| name: Build and Push Docker Image | |
| needs: parse-tag | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ${{ needs.parse-tag.outputs.dockerfile }} | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/${{ needs.parse-tag.outputs.image-name }}:${{ needs.parse-tag.outputs.version }} | |
| ghcr.io/${{ github.repository_owner }}/${{ needs.parse-tag.outputs.image-name }}:latest |