-
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (117 loc) · 3.85 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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Release
on:
push:
branches:
- development
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changesets.outputs.published }}
published-packages: ${{ steps.changesets.outputs.publishedPackages }}
publish-npm: ${{ steps.changesets.outputs.published }}
permissions:
pages: read
issues: write
actions: write
statuses: write
contents: write
pull-requests: write
security-events: write
steps:
# - uses: actions/create-github-app-token@v1
# id: app-token
# with:
# app-id: ${{ secrets.LADESA_BOT_ID }}
# private-key: ${{ secrets.LADESA_BOT_SECRET }}
# - name: Get GitHub App User ID
# id: get-user-id
# run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
# env:
# GH_TOKEN: ${{ steps.app-token.outputs.token }}
# - run: |
# git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
# git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
# token: ${{ steps.app-token.outputs.token }}
- name: Install
uses: ./.github/actions/prepare/install
with:
install-node: "true"
- name: Run changesets action
uses: changesets/action@v1
id: changesets
with:
# setupGitUser: false
setupGitUser: true
createGithubReleases: false
title: "chore: version packages"
commit: "chore: version packages"
publish: pnpm run -w changeset:tag
version: pnpm run -w changeset:version
env:
NPM_CONFIG_PROVENANCE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
name: Show the release job outputs
runs-on: ubuntu-latest
needs: [release]
steps:
- name: print outputs (for debug purposes only)
run: echo '${{ toJSON(needs.release.outputs) }}'
publish-npm:
name: Publish to the NPM registry
runs-on: ubuntu-latest
needs: [release]
if: needs.release.outputs.published == 'true' && needs.release.outputs.publish-npm == 'true'
permissions:
actions: read
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract tag
id: extract-tag
run: |
TAG=latest
FILE=.changeset/pre.json
if [ -f ${FILE} ]; then
TAG=$(cat ${FILE} | jq .tag);
fi
echo tag: ${TAG}
echo "TAG=${TAG}" >> $GITHUB_OUTPUT
- name: Publish to the NPM registry
uses: ./.github/actions/publish/npm
with:
tag: "${{ steps.extract-tag.outputs.tag }}"
npm-token: "${{ secrets.NPM_TOKEN }}"
edge-publish-npm:
name: Edge NPM package publish
runs-on: ubuntu-latest
needs: [release]
if: needs.release.outputs.published == 'false'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install
uses: ./.github/actions/prepare/install
with:
install-node: "true"
install-dotnet: "true"
- name: Build
uses: ./.github/actions/prepare/build
with:
workspace-build: "true"
- name: "Continuos Release: publish to pkg.pr.new"
run: pnpx pkg-pr-new publish --comment=update './integrations/npm/api-client-fetch'
cd-build-push-deploy:
name: "CD: Build, Push and Deploy"
uses: ./.github/workflows/cd-build-push-deploy.yml
secrets: inherit
needs: [release]