Repository navigation
91 lines (81 loc) · 3.36 KB
/
Copy pathrelease.yml
File metadata and controls
91 lines (81 loc) · 3.36 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
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
id-token: write # Required for OIDC
contents: write
pull-requests: write
jobs:
release:
if: github.repository == 'webpack/webpack'
name: Release
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.published-packages }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: lts/*
cache: yarn
- run: node tooling/retry.js yarn --frozen-lockfile
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@ae32849d5ba541f9ae29e40e22a623bc13562f51 # v2.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Formats what `changeset version` wrote before the action commits
# it, so the release pull request is not born failing fmt:check.
version-script: yarn version:release
# `changeset publish` refuses to run under Yarn Classic, so npm
# publishes instead. The action runs this on every push that leaves no
# changeset behind, hence the skip when npm already carries the
# version; it execs without a shell, hence `bash -c`; and it splits
# the command on double quotes, so there are none inside.
publish-script: bash -c "v=$(npm pkg get version | xargs); (npm view webpack@${v:?} version > /dev/null 2>&1 || npm publish) && node ./node_modules/.bin/changeset git-tag"
commit-message: "chore(release): new release"
pr-title: "chore(release): new release"
env:
NPM_TOKEN: "" # https://github.com/changesets/changesets/issues/1152#issuecomment-3190884868
announce-release:
needs: release
if: needs.release.outputs.published == 'true'
uses: ./.github/workflows/release-announcement.yml
secrets: inherit
trigger-documentation-update:
needs: release
if: needs.release.outputs.published == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Generate Token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
id: app-token
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Dispatch workflow
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
PUBLISHED_PACKAGES: ${{ needs.release.outputs.publishedPackages }}
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const packages = JSON.parse(process.env.PUBLISHED_PACKAGES);
const pkg = packages.find(p => p.name === "webpack");
if (!pkg) throw new Error("webpack package not found in published packages");
await github.rest.actions.createWorkflowDispatch({
owner: "webpack",
repo: "webpack-doc-kit",
workflow_id: "release.yml",
ref: "main",
inputs: {
tag: "v" + pkg.version,
},
});