-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (57 loc) · 1.86 KB
/
build-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
name: Build and Test
on:
push:
branches:
- "**"
tags:
- "*"
pull_request:
branches:
- '**:**'
workflow_dispatch:
permissions:
contents: read
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
head_tag: ${{ steps.head_tag.outputs.head_tag }}
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Retrieve tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Check if Git tag exists
id: head_tag
run: echo "::set-output name=head_tag::$(git tag --points-at HEAD)"
if: startsWith(github.ref, 'refs/heads/')
build:
runs-on: ubuntu-latest
needs: prepare
if: ${{ !startsWith(github.ref, 'refs/heads/') || !needs.prepare.outputs.head_tag }}
permissions:
contents: read
packages: read
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Setup Node.js environment
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: lts/*
registry-url: https://npm.pkg.github.com
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run postinstall scripts
run: npm rebuild && npm run prepare --if-present
- name: Run tests
run: npm test
- name: Trigger Docker build
uses: myrotvorets/trigger-repository-dispatch-action@dcc1a8db8562d98f3e2f84802c4a77a772aefaa2 # v2.0.0
with:
token: ${{ secrets.REPOSITORY_ACCESS_TOKEN }}
type: tests-passed
payload: '{ "ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "event_name": "${{ github.event_name }}" }'