-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (104 loc) · 3.28 KB
/
Copy pathci.yml
File metadata and controls
121 lines (104 loc) · 3.28 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v23
- name: Setup Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v15
with:
use-flakehub: disabled
use-gha-cache: enabled
- name: Install Dependencies
run: nix develop --command npm ci
- name: Test
run: nix develop --command npm run ci-test
release:
needs: test
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
timeout-minutes: 15
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
major: ${{ steps.release.outputs.major }}
pr: ${{ steps.release.outputs.pr }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Create Release PR
id: release
uses: googleapis/release-please-action@v5
with:
manifest-file: .github/config/release-please-manifest.json
config-file: .github/config/release-please-config.json
target-branch: main
build:
needs: release
if: ${{ needs.release.outputs.pr != '' }}
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ fromJSON(needs.release.outputs.pr).headBranchName }}
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v23
- name: Setup Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v15
with:
use-flakehub: disabled
use-gha-cache: enabled
- name: Install Dependencies
run: nix develop --command npm ci
- name: Build Dist
run: nix develop --command npm run package
- name: Commit Dist
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add --force dist/*
git diff --cached --quiet || git commit -m "chore: auto-generate dist ${{ needs.release.outputs.tag_name }}"
git push
tag-major:
needs: release
if: ${{ needs.release.outputs.release_created }}
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 5
env:
GIT_TAG: v${{ needs.release.outputs.major }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Update version tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -fa "$GIT_TAG" -m "chore: update $GIT_TAG to ${{ needs.release.outputs.tag_name }}"
git push origin "$GIT_TAG" --force