-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (84 loc) · 2.71 KB
/
release.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
87
88
concurrency:
group: ${{ github.workflow }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- uses: ./.github/actions/prepare
- run: pnpm build
- run: git config user.name "${GITHUB_ACTOR}"
- run: git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
- name: Delete branch protection on main
uses: actions/github-script@v6.4.1
with:
github-token: ${{ secrets.ACCESS_TOKEN }}
script: |
try {
await github.request(
`DELETE /repos/mcnaveen/Cart/branches/main/protection`,
);
} catch (error) {
if (!error.message?.includes?.("Branch not protected")) {
throw error;
}
}
- env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
if pnpm run should-semantic-release ; then
pnpm release-it --verbose
fi
- if: always()
name: Recreate branch protection on main
uses: actions/github-script@v6.4.1
with:
github-token: ${{ secrets.ACCESS_TOKEN }}
script: |
github.request(
`PUT /repos/mcnaveen/Cart/branches/main/protection`,
{
allow_deletions: false,
allow_force_pushes: true,
allow_fork_pushes: false,
allow_fork_syncing: true,
block_creations: false,
branch: "main",
enforce_admins: false,
owner: "mcnaveen",
repo: "Cart",
required_conversation_resolution: true,
required_linear_history: false,
required_pull_request_reviews: null,
required_status_checks: {
checks: [
{ context: "build" },
{ context: "compliance" },
{ context: "lint" },
{ context: "lint_knip" },
{ context: "lint_markdown" },
{ context: "lint_package_json" },
{ context: "lint_packages" },
{ context: "lint_spelling" },
{ context: "prettier" },
{ context: "test" },
],
strict: false,
},
restrictions: null,
}
);
name: Release
on:
push:
branches:
- main
permissions:
contents: write
id-token: write