Skip to content

Commit 82ba85d

Browse files
author
Jochum van der Ploeg
authored
feat: add mason publish workflow (#112)
* feat: add mason publish workflow * feat: add mason publish workflow
1 parent 9fce5d3 commit 82ba85d

File tree

2 files changed

+110
-0
lines changed

2 files changed

+110
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Mason Publish Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
mason_version:
7+
required: false
8+
type: string
9+
default: ""
10+
working_directory:
11+
required: false
12+
type: string
13+
default: "."
14+
runs_on:
15+
required: false
16+
type: string
17+
default: "ubuntu-latest"
18+
mason_credentials:
19+
required: true
20+
type: string
21+
22+
jobs:
23+
publish:
24+
defaults:
25+
run:
26+
working-directory: ${{inputs.working_directory}}
27+
28+
runs-on: ${{inputs.runs_on}}
29+
30+
steps:
31+
- name: 📚 Git Checkout
32+
uses: actions/checkout@v3
33+
34+
- name: 🎯 Setup Dart
35+
uses: dart-lang/setup-dart@v1
36+
with:
37+
sdk: ${{inputs.dart_sdk}}
38+
39+
- name: 🧱 Install Mason
40+
run: dart pub global activate mason_cli ${{inputs.mason_version}}
41+
42+
- name: 🔐 Setup Mason Credentials
43+
run: |
44+
mkdir -p $XDG_CONFIG_HOME/mason
45+
echo '${{inputs.mason_credentials}}' > "$XDG_CONFIG_HOME/mason/mason-credentials.json"
46+
47+
- name: 🌵 Dry Run
48+
run: mason publish --dry-run
49+
50+
- name: 📢 Publish
51+
run: mason publish -f

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,65 @@ jobs:
520520
pub_credentials: ${{ secrets.PUB_CREDENTIALS }}
521521
```
522522

523+
## Mason Publish Workflow
524+
525+
### Steps
526+
527+
The Mason Publish workflow consists of the following steps:
528+
529+
1. Install Mason
530+
2. Setup Mason credentials
531+
3. Dry run
532+
4. Publish
533+
534+
### Inputs
535+
536+
#### `mason_version`
537+
538+
**Optional** Which Mason version to use (e.g. `0.1.0-dev.50`).
539+
540+
**Default** `""`
541+
542+
#### `working_directory`
543+
544+
**Optional** The path to the root of the Mason brick.
545+
546+
**Default** `"."`
547+
548+
#### `runs_on`
549+
550+
**Optional** An optional operating system on which to run the workflow.
551+
552+
**Default** `"ubuntu-latest"`
553+
554+
#### `mason_credentials`
555+
556+
**Required** The mason credentials needed for publishing. This can be retrieved by reading out your `mason-credentials.json` on your system after you ran a `mason login`, the location of the file is different per operating system:
557+
558+
| OS | Path |
559+
| ------- | ----------------------------------------------------------------------------------------------- |
560+
| Linux | `$XDG_CONFIG_HOME/mason/mason-credentials.json` or `$HOME/.config/mason/mason-credentials.json` |
561+
| macOS | `~/Library/Application\ Support/mason/mason-credentials.json` |
562+
| Windows | `%APPDATA%/mason/mason-credentials.json` |
563+
564+
### Example Usage
565+
566+
We recommend using [GitHub Secrets][github_actions_secrets_docs] for safely storing and reading the credentials.
567+
568+
```yaml
569+
name: My Mason Brick Publish Workflow
570+
571+
on: pull_request
572+
573+
jobs:
574+
build:
575+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/mason_publish.yml@v1
576+
with:
577+
mason_version: "0.1.0-dev.50"
578+
working_directory: "packages/my_mason_brick"
579+
mason_credentials: ${{ secrets.MASON_CREDENTIALS }}
580+
```
581+
523582
[ci_badge]: https://github.com/VeryGoodOpenSource/very_good_workflows/actions/workflows/ci.yml/badge.svg
524583
[ci_link]: https://github.com/VeryGoodOpenSource/very_good_workflows/actions
525584
[github_workflows_link]: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions

0 commit comments

Comments
 (0)