-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (50 loc) · 1.63 KB
/
test-and-release.yaml
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
name: Test and Release
on: push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
test-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: Keep npm cache around to speed up installs
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci --no-audit
- name: Compile TypeScript
run: npx tsc
- name: Run unit tests
run: npm test
- name: Build
env:
PUBLIC_VERSION: ${{ github.sha }}
BASE_URL: /${{ github.event.repository.name }}
run: npm run build
- uses: actions/upload-artifact@v3
if: always()
with:
name: strava-app-${{ github.sha }}
path: build
- name: Publish to GitHub pages
if: github.ref == 'refs/heads/main'
run: |
echo "machine github.com login accesskey password ${{ secrets.GITHUB_TOKEN }}" > ~/.netrc
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git config --global init.defaultBranch gh-pages
cd build
touch .nojekyll
git init
git add -A
git commit -m "update web app"
git remote add origin https://github.com/${GITHUB_REPOSITORY}.git
git push -f origin HEAD:gh-pages
- name: Semantic release
continue-on-error: true
run: npx semantic-release