Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): fix GitHub CI workflow #441

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
env:
LOGS_DIR: /tmp/code-style/logs
LOGS_FILE: /tmp/code-style/logs/build-perf.log
NPM_VERSION: "7.x"
NPM_VERSION: "8.x"
TZ: "Europe/Brussels"
steps:
# See: https://github.com/marketplace/actions/checkout
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# See: https://github.com/marketplace/actions/setup-node-js-for-use-with-actions
- name: Use Node.js 12
uses: actions/setup-node@v1
# See: https://github.com/marketplace/actions/setup-node-js-environment
- name: Use Node.js 14
uses: actions/setup-node@v4
with:
node-version: "12"
node-version: "14"

- name: Create file & folder for GitHub Actions logs
run: |
Expand All @@ -37,14 +37,18 @@ jobs:
touch $LOGS_FILE

- name: Get tag name if exists
id: get_tag_name
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | sed -n "s/^refs\/tags\/\(\S*\).*$/\1/p")
run: |
TAG_NAME=$(echo $GITHUB_REF | sed -n "s/^refs\/tags\/\(\S*\).*$/\1/p")
echo "GH_ACTIONS_TAG=${TAG_NAME}" >> $GITHUB_ENV

- name: List main variables
run: |
echo "Commit SHA : ${GITHUB_SHA}"
echo "Tag : ${GH_ACTIONS_TAG}"
echo "Tag name : ${GH_ACTIONS_TAG}"
echo "Reference : ${GITHUB_REF}"
echo "Head branch : ${GITHUB_HEAD_REF}"
echo "Base branch : ${GITHUB_BASE_REF}"
echo "Build number: ${GITHUB_RUN_NUMBER}"
echo "Repository : ${GITHUB_REPOSITORY}"
echo "Event : ${GITHUB_EVENT_NAME}"
echo "Author : ${GITHUB_ACTOR}"
Expand All @@ -65,16 +69,15 @@ jobs:
- name: Build
run: npm run build

# See: https://github.com/marketplace/actions/upload-artifact
- uses: actions/upload-artifact@v1
# See: https://github.com/marketplace/actions/upload-a-build-artifact
- uses: actions/upload-artifact@v3
with:
name: dist-${{ github.run_id }}
path: dist

- name: Release
run: npm run release:publish
env:
GH_ACTIONS_TAG: ${{ steps.get_tag_name.outputs.TAG_NAME }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Save logs
Expand Down
25 changes: 15 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@commitlint/cli": "^16.2.1",
"@commitlint/config-conventional": "^16.2.1",
"@release-it/conventional-changelog": "^4.2.1",
"@types/node": "~14.14.31",
"codelyzer": "~6.0.2",
"commitizen": "^4.0.3",
"conventional-changelog-cli": "^2.0.31",
Expand Down
12 changes: 6 additions & 6 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ do
TEMP_CONFIG_PRETTIER="${testFolder}/prettier-test-file-${PRETTIER_VERSION}.js"
logDebug "create temporary prettier config file: ${TEMP_CONFIG_PRETTIER}"
echo "module.exports=require('../../lib/prettier/${PRETTIER_VERSION}/.prettierrc.js');" > ${TEMP_CONFIG_PRETTIER}
logDebug "run command \"npx prettier@${PRETTIER_VERSION} --config ${TEMP_CONFIG_PRETTIER} --write ${TEMP_TEST_PRETTIER}\""
testResult=$(npx prettier@${PRETTIER_VERSION} --config ${TEMP_CONFIG_PRETTIER} --write ${TEMP_TEST_PRETTIER} 2>&1)
logDebug "run command \"npx --yes prettier@${PRETTIER_VERSION} --config ${TEMP_CONFIG_PRETTIER} --write ${TEMP_TEST_PRETTIER}\""
testResult=$(npx --yes prettier@${PRETTIER_VERSION} --config ${TEMP_CONFIG_PRETTIER} --write ${TEMP_TEST_PRETTIER} 2>&1)
if [[ ${testResult} == *"[warn] Ignored unknown"* ]]; then
logInfo "The prettier configuration contains unknown rules"
die ${testResult}
Expand Down Expand Up @@ -97,8 +97,8 @@ do
TEMP_CONFIG_STYLELINT="${testFolder}/stylelint-test-file-${STYLELINT_VERSION}.json"
logDebug "create temporary stylelint config file: ${TEMP_CONFIG_STYLELINT}"
echo "{\"extends\":\"../../lib/stylelint/${STYLELINT_VERSION}/stylelint.config.js\"}" > ${TEMP_CONFIG_STYLELINT}
logDebug "run command \"npx stylelint@${STYLELINT_VERSION} --config ${TEMP_CONFIG_STYLELINT} ${TEMP_TEST_STYLELINT}\""
npx stylelint@${STYLELINT_VERSION} --config ${TEMP_CONFIG_STYLELINT} ${TEMP_TEST_STYLELINT}
logDebug "run command \"npx --yes stylelint@${STYLELINT_VERSION} --config ${TEMP_CONFIG_STYLELINT} ${TEMP_TEST_STYLELINT}\""
npx --yes stylelint@${STYLELINT_VERSION} --config ${TEMP_CONFIG_STYLELINT} ${TEMP_TEST_STYLELINT}
ghActionsGroupEnd "validate stylelint ${STYLELINT_VERSION}"
done

Expand All @@ -124,8 +124,8 @@ do
TEMP_CONFIG_TSCONFIG="${testFolder}/tsconfig-test-file-${TSCONFIG_VERSION}.json"
logDebug "create temporary tsconfig file: ${TEMP_CONFIG_TSCONFIG}"
echo "{\"extends\":\"../../lib/tsconfig/${TSCONFIG_VERSION}/tsconfig.json\",\"compilerOptions\":{\"baseUrl\":\".\"}}" > ${TEMP_CONFIG_TSCONFIG}
logDebug "run command \"npx -p typescript@${TSCONFIG_VERSION} -c 'tsc -p ${TEMP_CONFIG_TSCONFIG}'\""
npx -p typescript@${TSCONFIG_VERSION} -c "tsc -p ${TEMP_CONFIG_TSCONFIG}"
logDebug "run command \"npx --yes -p typescript@${TSCONFIG_VERSION} -c 'tsc -p ${TEMP_CONFIG_TSCONFIG}'\""
npx --yes -p typescript@${TSCONFIG_VERSION} -c "tsc -p ${TEMP_CONFIG_TSCONFIG}"
ghActionsGroupEnd "validate tsconfig ${TSCONFIG_VERSION}"
done

Expand Down