-
Notifications
You must be signed in to change notification settings - Fork 33
116 lines (101 loc) · 3.57 KB
/
release-visualization.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Release - Visualization
on:
workflow_dispatch:
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.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
# Extract version from branch name
- name: Set version
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
echo "VERSION=${BRANCH_NAME#release/vis-}" >> $GITHUB_ENV
# Create and push tag
- 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 }}"
# Build just for release artifacts
- 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: Build visualization
env:
NODE_OPTIONS: "--max_old_space_size=4096"
working-directory: ./visualization
run: |
npm ci
npm run build
npm run package
# Promote from staging
- 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: |
# Update version and publish
npm version ${{ env.VERSION }} --no-git-tag-version --allow-same-version
npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Create GitHub Release
- name: Add Changelog Entries to Release
uses: rasmus-saks/[email protected]
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
path: 'visualization/CHANGELOG.md'
title-template: 'Visualization release {version}'
tag-template: 'vis-{version}'
# Upload release assets
- name: Upload Release Files
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["visualization/dist/packages/*.zip"]'
# Deploy to production GitHub Pages
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
token: ${{ secrets.DEPLOY_TOKEN }}
branch: gh-pages
folder: visualization/dist/webpack
clean: true