Skip to content

Commit 5e42b4a

Browse files
committed
keep old versions deployed
1 parent 4a73154 commit 5e42b4a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/workflows/ci.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ jobs:
4141
- name: Install dependencies
4242
run: npm install
4343

44+
- name: Get version
45+
id: get_version
46+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
47+
4448
- name: Build
4549
run: |
4650
npx parcel build --public-url /dist/
4751
cp dist/spreadsheet_component.html spreadsheet.dist.handlebars
48-
npx parcel build --public-url https://lovasoa.github.io/sqlpage-spreadsheet/dist/
52+
npx parcel build --public-url https://lovasoa.github.io/sqlpage-spreadsheet/${{ steps.get_version.outputs.VERSION }}/dist/
4953
cp dist/spreadsheet_component.html spreadsheet.handlebars
5054
5155
- name: Create Release ZIP
@@ -82,8 +86,10 @@ jobs:
8286
run: |
8387
git config --global user.name 'GitHub Actions'
8488
git config --global user.email '[email protected]'
85-
git checkout --orphan gh-pages
86-
git rm -rf .
87-
git add dist
88-
git commit -m "Deploy to GitHub Pages"
89-
git push -f origin gh-pages:gh-pages
89+
git fetch origin gh-pages
90+
git checkout gh-pages
91+
mkdir -p ${{ steps.get_version.outputs.VERSION }}
92+
cp -r dist ${{ steps.get_version.outputs.VERSION }}/
93+
git add ${{ steps.get_version.outputs.VERSION }}
94+
git commit -m "Deploy version ${{ steps.get_version.outputs.VERSION }} to GitHub Pages"
95+
git push origin gh-pages

0 commit comments

Comments
 (0)