Skip to content

Commit 5f473f3

Browse files
committed
ci: Deploy emscripten
Automatically deploy the emscripten build to a branch building GitHub pages.
1 parent 910b0d6 commit 5f473f3

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/emscripten.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,49 @@ jobs:
143143
git add *.tar.gz
144144
git commit --amend -m "$DEPLOY_MESSAGE" || git commit -m "$DEPLOY_MESSAGE"
145145
git push --force || git push --set-upstream origin $DEPLOY_BRANCH
146+
147+
- name: 'Deploy'
148+
if: matrix.BuildType == 'BinDist'
149+
env:
150+
PUBLIC_REPO_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
151+
run: |
152+
git config --global user.email "actions@github.com"
153+
git config --global user.name "GitHub Actions"
154+
155+
export PACKAGE_NAME=${GITHUB_REPOSITORY##*/}
156+
export DEPLOY_MESSAGE=`sed 's/PACKAGE_NAME/'"$PACKAGE_NAME"'/' <<< "$DEPLOY_MESSAGE"`
157+
export DEPLOY_BRANCH=pages
158+
159+
export COMMIT_DATE=`git log -1 --format=%ad --date=short`
160+
export ARR_DATE=(${COMMIT_DATE//-/ })
161+
export MAJOR=${ARR_DATE[0]}
162+
export MINOR=${ARR_DATE[1]}
163+
164+
export REV_COUNT=`git rev-list --count HEAD`
165+
export SHORT_HASH=`git rev-parse --short HEAD`
166+
export PATCH=r${REV_COUNT}-${SHORT_HASH}
167+
168+
export PACKAGE_VERSION=${MAJOR}.${MINOR}.${PATCH}
169+
export TAR_NAME=${PACKAGE_NAME}-${PACKAGE_VERSION}-Emscripten
170+
echo ${TAR_NAME}
171+
172+
cd ..
173+
echo Moving..
174+
mv $PACKAGE_NAME-artifacts/${TAR_NAME}.tar.gz .
175+
echo Extracting..
176+
tar -zxvf ${TAR_NAME}.tar.gz
177+
178+
cd $PACKAGE_NAME-artifacts
179+
git checkout $DEPLOY_BRANCH || git checkout --orphan $DEPLOY_BRANCH
180+
git reset
181+
git clean -f
182+
git rm * || true
183+
184+
echo Committing..
185+
mv ../${TAR_NAME}/bin/* .
186+
mv ncjump.html index.html
187+
git add .
188+
git commit --amend -m "$DEPLOY_MESSAGE" || git commit -m "$DEPLOY_MESSAGE"
189+
190+
echo Pushing..
191+
git push --force || git push --set-upstream origin $DEPLOY_BRANCH

0 commit comments

Comments
 (0)