Skip to content

Release - Visualization #24

Release - Visualization

Release - Visualization #24

name: Release - Visualization
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.131.3)'
required: true
type: string
pull_request:
types:
- closed
branches:
- main
paths:
- 'visualization/**'
- 'gh-pages/_posts/release/*vis_*.md'
env:
VERSION: "0.0.0"
jobs:
promote_and_release:
if: |
(github.event_name == 'workflow_dispatch') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'release') &&
startsWith(github.event.pull_request.head.ref, 'release/vis-'))
name: Promote and Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
else
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
echo "VERSION=${BRANCH_NAME#release/vis-}" >> $GITHUB_ENV
fi
- name: Create tag
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git tag "vis-${{ env.VERSION }}"
git push origin "vis-${{ env.VERSION }}"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y wine-stable zip
- name: Enable analysis execution rights
working-directory: ./analysis
run: |
chmod +x ./gradlew
- name: Build visualization
env:
NODE_OPTIONS: "--max_old_space_size=4096"
working-directory: ./visualization
run: |
npm ci
npm run build
npm run package
# Debug step to verify files
- name: List build artifacts
run: |
echo "Contents of visualization/dist/packages:"
ls -la visualization/dist/packages/
echo "Found zip files:"
find visualization/dist/packages -name "*.zip"
# Setup Bun for version-manager
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
# Create release with changelog
- name: Create Release
id: create_release
run: |
# Extract changelog entries
CHANGELOG_CONTENT=$(bun script/version-manager.ts extract-changelog visualization)
# Create release with changelog
gh release create "vis-${{ env.VERSION }}" \
--title "Visualization release ${{ env.VERSION }}" \
--notes "$CHANGELOG_CONTENT" \
visualization/dist/packages/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Pull and retag Docker image
run: |
docker pull codecharta/codecharta-visualization:staging
docker tag codecharta/codecharta-visualization:staging codecharta/codecharta-visualization:latest
docker tag codecharta/codecharta-visualization:staging codecharta/codecharta-visualization:${{ env.VERSION }}
docker push codecharta/codecharta-visualization:latest
docker push codecharta/codecharta-visualization:${{ env.VERSION }}
- name: Publish npm package
working-directory: ./visualization
run: |
npm version ${{ env.VERSION }} --no-git-tag-version --allow-same-version
npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Sample File for Web Demo
run: sh ./script/build_demo_file_visualization.sh
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
token: ${{ secrets.DEPLOY_TOKEN }}
branch: gh-pages
folder: visualization/dist/webpack
clean: true