From 5f473f305839878bb82687e233abf7cac905e47d Mon Sep 17 00:00:00 2001 From: Antonio Caggiano Date: Thu, 4 Mar 2021 15:56:00 +0100 Subject: [PATCH] ci: Deploy emscripten Automatically deploy the emscripten build to a branch building GitHub pages. --- .github/workflows/emscripten.yml | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index e9d196c..6dcdfe1 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -143,3 +143,49 @@ jobs: git add *.tar.gz git commit --amend -m "$DEPLOY_MESSAGE" || git commit -m "$DEPLOY_MESSAGE" git push --force || git push --set-upstream origin $DEPLOY_BRANCH + + - name: 'Deploy' + if: matrix.BuildType == 'BinDist' + env: + PUBLIC_REPO_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }} + run: | + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + export PACKAGE_NAME=${GITHUB_REPOSITORY##*/} + export DEPLOY_MESSAGE=`sed 's/PACKAGE_NAME/'"$PACKAGE_NAME"'/' <<< "$DEPLOY_MESSAGE"` + export DEPLOY_BRANCH=pages + + export COMMIT_DATE=`git log -1 --format=%ad --date=short` + export ARR_DATE=(${COMMIT_DATE//-/ }) + export MAJOR=${ARR_DATE[0]} + export MINOR=${ARR_DATE[1]} + + export REV_COUNT=`git rev-list --count HEAD` + export SHORT_HASH=`git rev-parse --short HEAD` + export PATCH=r${REV_COUNT}-${SHORT_HASH} + + export PACKAGE_VERSION=${MAJOR}.${MINOR}.${PATCH} + export TAR_NAME=${PACKAGE_NAME}-${PACKAGE_VERSION}-Emscripten + echo ${TAR_NAME} + + cd .. + echo Moving.. + mv $PACKAGE_NAME-artifacts/${TAR_NAME}.tar.gz . + echo Extracting.. + tar -zxvf ${TAR_NAME}.tar.gz + + cd $PACKAGE_NAME-artifacts + git checkout $DEPLOY_BRANCH || git checkout --orphan $DEPLOY_BRANCH + git reset + git clean -f + git rm * || true + + echo Committing.. + mv ../${TAR_NAME}/bin/* . + mv ncjump.html index.html + git add . + git commit --amend -m "$DEPLOY_MESSAGE" || git commit -m "$DEPLOY_MESSAGE" + + echo Pushing.. + git push --force || git push --set-upstream origin $DEPLOY_BRANCH