generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 23
75 lines (71 loc) · 2.1 KB
/
test.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: 'build-test'
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install node dependencies
run: |
npm install
- name: Build dist and run tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run all
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v4
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Run tests
uses: ./
with:
path: __tests__
dry-run: true
check-repo: ${{ github.event_name == 'push' }}
publish: # publish dependency-free release with only self-contained dist directory
if: github.event_name == 'push' && github.ref_name == 'main'
runs-on: ubuntu-latest
needs:
- build
- test
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Commit dist
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add dist
git commit -m "Added dist files"
git tag v2 -f
- name: Push dist
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: dist/v2
tags: true
force: true