mirror of
https://github.com/firstsun-dev/git-files-sync.git
synced 2026-07-22 17:20:30 +00:00
chore: use direct Lint and Test jobs to satisfy branch protection rules
This commit is contained in:
parent
3dca169a07
commit
dc3c56dd9e
3 changed files with 59 additions and 79 deletions
47
.github/workflows/check.yml
vendored
47
.github/workflows/check.yml
vendored
|
|
@ -11,29 +11,46 @@ on:
|
|||
- master
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- run: npm run lint
|
||||
|
||||
test:
|
||||
uses: ./.github/workflows/reusable-check.yml
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- run: npm run test -- --coverage
|
||||
- id: version
|
||||
run: echo "version=$(node -p "require('./manifest.json').version")" >> $GITHUB_OUTPUT
|
||||
|
||||
artifact:
|
||||
name: Package Artifact
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build plugin
|
||||
run: npm run build
|
||||
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- name: Create plugin package
|
||||
run: |
|
||||
VERSION=${{ needs.test.outputs.version }}
|
||||
|
|
@ -42,9 +59,7 @@ jobs:
|
|||
ZIP_NAME="git-files-sync-${VERSION}-${BRANCH_NAME_SAFE}.zip"
|
||||
zip -j "$ZIP_NAME" main.js manifest.json styles.css
|
||||
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: plugin-build-${{ needs.test.outputs.version }}-${{ github.sha }}
|
||||
path: ${{ env.ZIP_NAME }}
|
||||
|
|
|
|||
46
.github/workflows/reusable-check.yml
vendored
46
.github/workflows/reusable-check.yml
vendored
|
|
@ -1,46 +0,0 @@
|
|||
name: Reusable Check
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
version:
|
||||
description: "The version from manifest.json"
|
||||
value: ${{ jobs.check.outputs.version }}
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Lint, Test, and Build
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run linter
|
||||
run: npm run lint
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: npm run test -- --coverage
|
||||
|
||||
- name: Build plugin
|
||||
run: npm run build
|
||||
|
||||
- name: Check build artifacts
|
||||
run: |
|
||||
if [ ! -f main.js ]; then exit 1; fi
|
||||
if [ ! -f manifest.json ]; then exit 1; fi
|
||||
if [ ! -f styles.css ]; then exit 1; fi
|
||||
|
||||
- name: Get version from manifest
|
||||
id: version
|
||||
run: echo "version=$(node -p "require('./manifest.json').version")" >> $GITHUB_OUTPUT
|
||||
45
.github/workflows/semantic-release.yml
vendored
45
.github/workflows/semantic-release.yml
vendored
|
|
@ -12,34 +12,45 @@ permissions:
|
|||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- run: npm run lint
|
||||
|
||||
test:
|
||||
uses: ./.github/workflows/reusable-check.yml
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- run: npm run test -- --coverage
|
||||
|
||||
release:
|
||||
name: Build and Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
|
||||
needs: [lint, test]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build plugin
|
||||
run: npm run build
|
||||
|
||||
- name: Release
|
||||
env:
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: npx semantic-release
|
||||
|
|
|
|||
Loading…
Reference in a new issue