-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.19 KB
/
build-and-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
76
77
78
79
80
81
82
83
84
85
86
name: Build and release - staging
on:
push:
branches:
- main
- dev/*
- feat/*
- feature/*
- hotfix/*
jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm test
semantic-release:
needs: build-and-test
if: "!contains(github.event.head_commit.message, '[skip ci]')"
name: Semantic Release
runs-on: ubuntu-latest
environment: staging
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Prepare prerelease semantic
if: github.ref != 'refs/heads/main'
run: mv .releaserc.prerelease.yaml .releaserc.yaml
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic # Need an `id` for output variables
with:
dry_run: true
extra_plugins: |
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/changelog
@semantic-release/github
env:
GITHUB_TOKEN: ${{ secrets.GH_PA_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Do something when a new release published
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
echo ${{ steps.semantic.outputs.new_release_major_version }}
echo ${{ steps.semantic.outputs.new_release_minor_version }}
echo ${{ steps.semantic.outputs.new_release_patch_version }}