-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(stg): update staging visualization workflow for Docker and npm publishing #3833 * feat(stg): add staging deployment workflow for analysis with Docker and npm publishing * refactor(stg): remove sample file creation and GitHub Pages deployment steps from workflow * fix(stg): add workflow_dispatch trigger to staging analysis and remove npm package step
- Loading branch information
1 parent
9920af9
commit b72f0b2
Showing
2 changed files
with
111 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Staging Deployment - Analysis | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'analysis/**' | ||
|
||
jobs: | ||
build_and_deploy: | ||
name: Build and Deploy | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
# Get short SHA for tagging | ||
- name: Set short SHA | ||
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Build analysis | ||
working-directory: ./analysis | ||
run: | | ||
chmod +x ./gradlew | ||
./gradlew build | ||
# Docker build and push with staging tags | ||
- name: Login to 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: ./analysis | ||
push: true | ||
tags: | | ||
codecharta/codecharta-analysis:staging | ||
codecharta/codecharta-analysis:staging-${{ env.SHORT_SHA }} | ||
# Publish node-wrapper to npm with staging tag | ||
- name: Update package version | ||
working-directory: ./analysis/node-wrapper | ||
run: | | ||
npm version "0.0.0-staging-${SHORT_SHA}" --no-git-tag-version | ||
- name: Publish to npm | ||
working-directory: ./analysis/node-wrapper | ||
run: | | ||
npm publish --tag staging | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
name: Staging Environment - Visualization | ||
name: Staging Deployment - Visualization | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'visualization/**' | ||
|
||
jobs: | ||
build_and_deploy_visualization: | ||
name: Build and Deploy Visualization | ||
|
||
build_and_deploy: | ||
name: Build and Deploy | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js environment | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Build visualization | ||
env: | ||
|
@@ -31,11 +33,45 @@ jobs: | |
npm ci | ||
npm run build | ||
- name: Deploy Visualization to GitHub Pages | ||
# Get short SHA for tagging | ||
- name: Set short SHA | ||
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
|
||
# Docker build and push with staging tags | ||
- name: Login to 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: ./visualization | ||
push: true | ||
tags: | | ||
codecharta/codecharta-visualization:staging | ||
codecharta/codecharta-visualization:staging-${{ env.SHORT_SHA }} | ||
# Publish to npm with staging tag | ||
- name: Update package version | ||
working-directory: ./visualization | ||
run: | | ||
npm version "0.0.0-staging-${SHORT_SHA}" --no-git-tag-version | ||
- name: Publish to npm | ||
working-directory: ./visualization | ||
run: | | ||
npm publish --tag staging | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
# Deploy to GitHub Pages staging environment | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
token: ${{ secrets.DEPLOY_TOKEN }} | ||
branch: gh-pages | ||
folder: visualization/dist/webpack | ||
target-folder: stg/visualization | ||
clean: false | ||
clean: true |