generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 17
46 lines (45 loc) · 1.58 KB
/
npm-run-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: 'npm run package'
# Main use case: repackage when Dependabot updates a dependency
on:
push:
branches:
- 'dependabot/**'
workflow_dispatch:
inputs:
branch:
description: 'Process this branch'
required: false
type: string
jobs:
npm-run-package-and-push: # make sure build/ci work properly
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event.repository.owner.login == 'git-for-windows'
environment: git-for-windows-ci-push
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.repository.full_name }}
ref: ${{ inputs.branch }}${{ github.event.ref }}
token: ${{ secrets.GIT_FOR_WINDOWS_CI_PUSH }}
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm run format && git diff-files
- run: npm run test
- run: npm run package
- name: check if commit & push is needed
id: check
run: |
git add -u -- dist/ &&
git diff-index --cached --exit-code HEAD -- ||
echo "::set-output name=need-to-commit::yes"
- name: commit & push
if: steps.check.outputs.need-to-commit == 'yes'
run: |
git config user.name "${{github.actor}}" &&
git config user.email "${{github.actor}}@users.noreply.github.com" &&
git commit -m 'npm run build && npm run package' -- dist/ &&
git update-index --refresh &&
git diff-files --exit-code &&
git diff-index --cached --exit-code HEAD -- &&
git push