mirror of
https://github.com/firstsun-dev/git-files-sync.git
synced 2026-07-22 17:20:30 +00:00
66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: Check
|
|
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- main
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- 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:
|
|
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:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
- run: npm ci
|
|
- run: npm run build
|
|
- name: Create plugin package
|
|
run: |
|
|
VERSION=${{ needs.test.outputs.version }}
|
|
BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
|
|
BRANCH_NAME_SAFE=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9._-]/-/g')
|
|
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
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: plugin-build-${{ needs.test.outputs.version }}-${{ github.sha }}
|
|
path: ${{ env.ZIP_NAME }}
|
|
retention-days: 7
|