Skip to content

Commit

Permalink
Merge pull request #30 from github/improve-ci-workflows
Browse files Browse the repository at this point in the history
improve ci workflows
  • Loading branch information
GrantBirki committed Aug 7, 2023
2 parents 6ceeae7 + 8dc1aff commit e2dee3c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 38 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@ on:
- main
- 'releases/*'

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# check the node version from the .node-version file
- name: fetch node version
id: node-version
run: |
version=$(cat .node-version)
echo "version=${version}" >> $GITHUB_OUTPUT
- name: setup node
uses: actions/setup-node@v3
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # pin@v3.6.0
with:
node-version: ${{ steps.node-version.outputs.version }}
cache: npm
node-version-file: .node-version
cache: 'npm'

- name: install dependencies
run: npm ci
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/package-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,29 @@ on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
package-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# check the node version from the .node-version file
- name: fetch node version
id: node-version
run: |
version=$(cat .node-version)
echo "version=${version}" >> $GITHUB_OUTPUT
- name: setup node
uses: actions/setup-node@v3
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # pin@v3.6.0
with:
node-version: ${{ steps.node-version.outputs.version }}
cache: npm
node-version-file: .node-version
cache: 'npm'

- name: Install dependencies
- name: install dependencies
run: npm ci

- name: Rebuild the dist/ directory
- name: rebuild the dist/ directory
run: npm run bundle

- name: Compare the expected and actual dist/ directories
- name: compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
Expand All @@ -43,7 +39,7 @@ jobs:
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@v3.1.2
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@ on:
- main
- 'releases/*'

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# check the node version from the .node-version file
- name: fetch node version
id: node-version
run: |
version=$(cat .node-version)
echo "version=${version}" >> $GITHUB_OUTPUT
- name: setup node
uses: actions/setup-node@v3
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # pin@v3.6.0
with:
node-version: ${{ steps.node-version.outputs.version }}
cache: npm
node-version-file: .node-version
cache: 'npm'

- name: install dependencies
run: npm ci

- run: npm ci
- run: npm run ci-test
- name: test
run: npm run ci-test
4 changes: 2 additions & 2 deletions script/release
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GREEN='\033[0;32m'
BLUE='\033[0;34m'

latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo -e "The latest release tag is:${BLUE}${latest_tag}${OFF}"
echo -e "The latest release tag is: ${BLUE}${latest_tag}${OFF}"
read -p 'New Release Tag (vX.X.X format): ' new_tag

tag_regex='^v\d\.\d\.\d$'
Expand All @@ -26,5 +26,5 @@ echo -e "${GREEN}OK${OFF} - Tagged: $new_tag"

git push --tags

echo -e "${GREEN}OK${OFF} - Tags pushed to remote! This will trigger a GitHub action release"
echo -e "${GREEN}OK${OFF} - Tags pushed to remote!"
echo -e "${GREEN}DONE${OFF}"

0 comments on commit e2dee3c

Please sign in to comment.