Skip to content

Commit 036cbe0

Browse files
authoredJan 18, 2023
Minimal, initial fixes to automated publishing article (#4531)
I will follow up with more fixes, but I wanted to get these fixes out right away. - Fixes image links - Fixes `raw` tags being unclosed with `endraw` - Move automated publishing subsection to appropriate location - Adjust Github -> GitHub Fixes #4530
1 parent 6c8553a commit 036cbe0

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed
 

‎src/tools/pub/automated-publishing.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ to use in some environments, but also pose a larger risk if accidentally leaked.
2828
{{site.alert.end}}
2929

3030

31-
## Publishing packages using Github Actions
31+
## Publishing packages using GitHub Actions
3232

3333
You can configure automated publishing using GitHub Actions. This involves:
3434
* Enabling automated publishing on pub.dev, specifying:
@@ -61,21 +61,21 @@ If you have sufficient permission, you can enable automated publishing by:
6161
1. Click **Enable publishing from GitHub Actions**, this prompts you to
6262
specify:
6363
* A repository (`<organization>/<repository>`, example: `dart-lang/pana`),
64-
* A _tag-pattern_ (a string containing `{% raw %}{{version}}{% raw %}`).
64+
* A _tag-pattern_ (a string containing `{% raw %}{{version}}{% endraw %}`).
6565

66-
The _repository_ is the `<organization>/<repository>` on Github.
66+
The _repository_ is the `<organization>/<repository>` on GitHub.
6767
For example, if your repository is
6868
`https://github.com/dart-lang/pana` you must specify `dart-lang/pana` in the
6969
repository field.
7070

71-
The _tag pattern_ is a string that must contain `{% raw %}{{version}}{% raw %}`.
72-
Only Github Actions triggered by a push of a tag that matches this
71+
The _tag pattern_ is a string that must contain `{% raw %}{{version}}{% endraw %}`.
72+
Only GitHub Actions triggered by a push of a tag that matches this
7373
_tag pattern_ will be allowed to publish your package.
7474

75-
[!Configuration of publishing from GitHub Actions on pub.dev](pub-dev-gh-setup.png)
75+
![Configuration of publishing from GitHub Actions on pub.dev](pub-dev-gh-setup.png)
7676

77-
**Example:** a _tag pattern_ like `v{% raw %}{{version}}{% raw %}` allows
78-
Github Actions (triggered by `git tag v1.2.3 && git push v1.2.3`) to publish
77+
**Example:** a _tag pattern_ like `v{% raw %}{{version}}{% endraw %}` allows
78+
GitHub Actions (triggered by `git tag v1.2.3 && git push v1.2.3`) to publish
7979
version `1.2.3` of your package. Thus, it's also important that the `version` key in
8080
`pubspec.yaml` matches this version number.
8181

@@ -171,13 +171,13 @@ To publish to pub.dev, subsequent steps can run `dart pub publish --force`.
171171
[sec-gh-environment]: #hardening-security-with-github-deployment-environments
172172

173173

174-
### Triggering automated publishing from Github Actions
174+
### Triggering automated publishing from GitHub Actions
175175

176176
After you've configured automated publishing on `pub.dev` and created a
177177
GitHub Actions workflow, you can publish a new version of your package.
178178
To publish, push a _git tag_ matching the configured _tag pattern_.
179179

180-
```console
180+
```terminal
181181
$ cat pubspec.yaml
182182
package: my_package_name
183183
version: 1.2.3 # must match the version number used in the git tag
@@ -200,7 +200,7 @@ Once published, you can see the publication event in the `audit-log` on
200200
The `audit-log` entry should contain a link to the GitHub Action run that
201201
published the package version.
202202

203-
[!Audit log after publishing from GitHub Actions](audit-log-pub-gh.png)
203+
![Audit log after publishing from GitHub Actions](audit-log-pub-gh.png)
204204

205205
If you don't like using the `git` CLI to create tags, you can create _releases_
206206
on GitHub from `https://github.com/<organization>/<repository>/releases/new`.
@@ -233,7 +233,7 @@ To require a _GitHub Actions environment_ for publishing you must:
233233
1. Click **Require GitHub Actions environment**.
234234
1. Specify an **Environment** name, (`pub.dev` is typically a good name)
235235

236-
[!Configure pub.dev to require a GitHub deployment environment](pub-dev-gh-env-setup.png)
236+
![Configure pub.dev to require a GitHub deployment environment](pub-dev-gh-env-setup.png)
237237

238238
When an environment is required on pub.dev, GitHub Actions won't be able to
239239
publish unless they have `environment: pub.dev`. Thus, you must:
@@ -271,7 +271,7 @@ configure _required reviewers_. If you configure this option, GitHub prevents
271271
actions with the environment from running until one of the
272272
_required reviewers_ have approved the run.
273273

274-
[!GitHub Action waiting for deployment review](gh-pending-review.png)
274+
![GitHub Action waiting for deployment review](gh-pending-review.png)
275275

276276

277277
## Publishing from Google Cloud Build
@@ -329,7 +329,7 @@ grant Cloud Build permission to impersonate this service account.
329329
You created this account in the previous step:
330330
`pub-dev@$PROJECT_ID.iam.gserviceaccount.com`
331331

332-
[!Configuration that allows service account to publish on pub.dev](pub-dev-gcb-config.png)
332+
![Configuration that allows service account to publish on pub.dev](pub-dev-gcb-config.png)
333333

334334
With this procedure complete, anyone who can impersonate the service account can
335335
publish new versions of the package. Make sure to review who has permissions to
@@ -443,7 +443,7 @@ repository in the `/cloudbuild.yaml` file.
443443
Do **not** specify a _service account_ for the build to be triggered with.
444444
Instead you'll want to use the default service account for Cloud Build.
445445

446-
[!Configuration for trigger](gcb-trigger-configuration.png)
446+
![Configuration for trigger](gcb-trigger-configuration.png)
447447

448448
{{site.alert.note}}
449449
You can configure the Cloud Build trigger to run under a custom
@@ -477,12 +477,12 @@ requires approval, it won't run when triggered. Instead, it'll wait for
477477
approval.
478478
This can be used to limit who can publish new versions of your package.
479479

480-
[!Enabling approvals in configuration of the Cloud Build trigger](gcb-approval-checkbox.png)
480+
![Enabling approvals in configuration of the Cloud Build trigger](gcb-approval-checkbox.png)
481481

482482
Only a user with the **Cloud Build Approver** role can give approval.
483483
When giving a approval, the approver can specify a URL and comment.
484484

485-
[!Cloud Build run waiting for approval to run](gcp-waiting-for-approval.png)
485+
![Cloud Build run waiting for approval to run](gcp-waiting-for-approval.png)
486486

487487
You can also configure notifications for pending approvals.
488488
To learn more, check out [gate build on approval][17].
@@ -491,7 +491,7 @@ To learn more, check out [gate build on approval][17].
491491
## Publish from anywhere using a Service Account
492492

493493
To allow automated publishing outside of GitHub Actions, you might
494-
authenticate using service accounts in way similiar to _Cloud Build_.
494+
authenticate using service accounts in way similar to _Cloud Build_.
495495

496496
This usually involves:
497497
* [Create a service account for publishing][create-svc],

‎src/tools/pub/publishing.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ dependencies:
183183
transmogrify: ^1.0.0
184184
```
185185
186+
### Automated publishing
187+
188+
Once the first version of a package has been published,
189+
it is possible to configure automated publishing
190+
through GitHub Actions or Google Cloud service accounts.
191+
To learn more about automated publishing, see
192+
[Automated publishing of packages to pub.dev](/tools/pub/automated-publishing).
193+
186194
### Transferring a package to a verified publisher
187195
188196
To transfer a package to a verified publisher,
@@ -423,14 +431,6 @@ where you can mark the package as discontinued.
423431
If you change your mind, you can remove the discontinued mark at any time.
424432

425433

426-
## Automated publishing
427-
428-
Once the first version of a package has been published, it is possible to
429-
configured automated publishing through GitHub Actions or Google Cloud
430-
service acconts. See [automated publishing](/tools/pub/automated-publishing)
431-
for details.
432-
433-
434434
[Create a verified publisher]: {{site.pub}}/create-publisher
435435
[BSD 3-clause license]: https://opensource.org/licenses/BSD-3-Clause
436436
[Google Account]: https://support.google.com/accounts/answer/27441

0 commit comments

Comments
 (0)
Please sign in to comment.