Skip to content

Bump memfs from 3.4.13 to 3.5.1 #284

Bump memfs from 3.4.13 to 3.5.1

Bump memfs from 3.4.13 to 3.5.1 #284

Workflow file for this run

name: Main workflow
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
lint:
name: Run linter
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- uses: actions/checkout@v3
- run: npm ci
- run: npm run lint
test:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- uses: actions/checkout@v3
- run: npm ci
- run: npm run test -- --reporters="github-actions"
- run: |
npm run testrun
test -d _dest && echo dest OK
test -f _dest/build.zip && echo build.zip OK
test `find _dest | wc -l` = "9" && echo file count OK
test -f _dest/.meta/src_files && echo src_files OK
test `cat _dest/.meta/src_files | wc -l` = "3" && echo src_files line count OK
auto-tag:
name: Add a tag on new version
needs:
- lint
- test
runs-on: ubuntu-latest
# ORIGINAL REPO, to avoid running for forks
if: github.ref == 'refs/heads/master' && github.repository == 'sbcgua/mockup-compiler-js'
steps:
- uses: actions/checkout@v3
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Detect version change
id: detect_version_change
run: |
LAST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
LAST_TAG=${LAST_TAG#v}
CURRENT_VERSION=$(jq -r -c .version package.json)
echo "Last tag: ${LAST_TAG}, Current version: ${CURRENT_VERSION}"
if [ "${LAST_TAG}" = "${CURRENT_VERSION}" ]; then
echo "Version change was not detected, exiting..."
else
echo "Version change detected"
echo "::set-output name=VERSION_CHANGED::yes"
echo "::set-output name=NEW_VERSION::$CURRENT_VERSION"
fi
- name: Create new tag
if: success() && steps.detect_version_change.outputs.VERSION_CHANGED == 'yes'
env:
GITHUB_TOKEN: ${{ secrets.DEPLOYMENT_TOKEN }}
run: |
if [ -z "${GITHUB_TOKEN}" ]; then
echo "GITHUB_TOKEN is undefined"
exit 1
fi
AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
API_ENDPOINT="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/refs"
API_REQUEST="{ \"ref\": \"refs/tags/v${{ steps.detect_version_change.outputs.NEW_VERSION }}\", \"sha\": \"${GITHUB_SHA}\" }"
echo "Api endpoint: ${API_ENDPOINT}"
echo "Api request: ${API_REQUEST}"
HTTP_CODE=$(curl -s -X POST "$API_ENDPOINT" -H "$AUTH_HEADER" -d "$API_REQUEST" -w "%{http_code}\n" -o /tmp/response.json)
echo "Http code: ${HTTP_CODE}"
cat /tmp/response.json
[[ $HTTP_CODE == 2* ]]