Skip to content

Commit

Permalink
chore(build): switch to shared workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Jan 21, 2024
1 parent fe90a91 commit ea44571
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 83 deletions.
39 changes: 3 additions & 36 deletions .github/workflows/check-dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
# This is stupid, but it's how GH works I guess.
name: Check dist/
name: "check dist/"

on:
push:
Expand All @@ -17,40 +17,7 @@ on:
- '**.md'
workflow_dispatch:

env:
NODE_VERSION: "20.x"

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

steps:
- uses: actions/checkout@v4

- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

- name: Install dependencies
run: yarn install --immutable

- name: Rebuild the dist/ directory
run: |
yarn run build
- 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:"
git diff
exit 1
fi
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
uses: "KyoriPowered/.github/.github/workflows/shared-action-check-dist.yaml@trunk"
secrets: "inherit"
33 changes: 5 additions & 28 deletions .github/workflows/fill-in-tags.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
name: Fill in release tags

name: "fill in release tags"

# When a release tag is pushed (i.e v2.3.0), we can update shortened tags
on:
release:
types:
- "released"
types: [ "released" ]

jobs:
check-dist:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v4"
- name: "create tag parts"
id: "match"
uses: "KyoriPowered/action-regex-match@v4"
with:
text: "${{ github.event.release.tag_name }}"
regex: 'v((\d+)\.(\d+)\.(\d+))'
- name: "create and push tags"
env:
RELEASE: "${{ steps.match.outputs.group1 }}"
MAJOR: "${{ steps.match.outputs.group2 }}"
MINOR: "${{ steps.match.outputs.group3 }}"
PATCH: "${{ steps.match.outputs.group4 }}"
run: |
git config user.name github-actions
git config user.email [email protected]
git tag -f v$MAJOR.$MINOR -m "Release $RELEASE"
git tag -f v$MAJOR -m "Release $RELEASE"
git push -f --tags origin
fill-tags:
uses: "KyoriPowered/.github/.github/workflows/shared-action-fill-in-tags.yaml@trunk"
secrets: "inherit"
25 changes: 6 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
name: Test
name: "test"

on: push

env:
NODE_VERSION: "20.x"
on: "push"

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- run: yarn install --immutable
- run: yarn test
- run: yarn format-check
- run: yarn lint
uses: "KyoriPowered/.github/.github/workflows/shared-action-test.yaml@trunk"
secrets: "inherit"

functional-test:
runs-on: ubuntu-latest
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- uses: "actions/checkout@v4.1.1"
- name: "Test API calls"
uses: ./
id: test-run
Expand Down

0 comments on commit ea44571

Please sign in to comment.