From ea44571d298f2c511cd5d6aec61c3b59c2b89e23 Mon Sep 17 00:00:00 2001 From: zml Date: Sun, 21 Jan 2024 14:50:17 -0800 Subject: [PATCH] chore(build): switch to shared workflows --- .github/workflows/check-dist.yaml | 39 +++-------------------------- .github/workflows/fill-in-tags.yaml | 33 ++++-------------------- .github/workflows/test.yml | 25 +++++------------- 3 files changed, 14 insertions(+), 83 deletions(-) diff --git a/.github/workflows/check-dist.yaml b/.github/workflows/check-dist.yaml index 945fffc..8df7df5 100644 --- a/.github/workflows/check-dist.yaml +++ b/.github/workflows/check-dist.yaml @@ -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: @@ -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" diff --git a/.github/workflows/fill-in-tags.yaml b/.github/workflows/fill-in-tags.yaml index 8dd3349..4f51fd7 100644 --- a/.github/workflows/fill-in-tags.yaml +++ b/.github/workflows/fill-in-tags.yaml @@ -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 github-actions@github.com - - 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" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8adfc77..36daede 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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