From 360ed023f2f1a33c88576acc6043268128ed3729 Mon Sep 17 00:00:00 2001 From: Istvan Soos Date: Wed, 4 Jan 2023 16:09:22 +0100 Subject: [PATCH 1/3] Reusable workflow for publishing. --- .github/workflows/publish.yml | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c131f95 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,44 @@ +name: Publish to pub.dev + +## Caller of this workflow should use it as follows: +## jobs: +## publish: +## uses: dart-lang/setup-dart/.github/workflows/publish.yml +## # with: +## # working-directory: path/to/sub/directory + +on: + workflow_call: + inputs: + environment: + description: if specified, the workflow is required to be run in this environment (with additional approvals) + required: false + type: string + working-directory: + description: directory with-in the repository where the package is located (if not in the repository root) + required: false + type: string + +jobs: + publish: + name: 'Publish to pub.dev' + environment: ${{ inputs.environment }} + permissions: + id-token: write # This is required for requesting the JWT + runs-on: ubuntu-latest + steps: + # Checkout repository + - uses: actions/checkout@v3 + # Setup Dart SDK with JWT token + - uses: dart-lang/setup-dart@main + # Minimal package setup and dry run checks. + - name: Install dependencies + run: dart pub get + working-directory: ${{ inputs.working-directory }} + - name: Publish - dry run + run: dart pub publish --dry-run + working-directory: ${{ inputs.working-directory }} + # Publishing... + - name: Publish to pub.dev + run: dart pub publish -f + working-directory: ${{ inputs.working-directory }} From 3e58ec9d5da0e3d00e7e9d164ca3d77a486ea1b5 Mon Sep 17 00:00:00 2001 From: Istvan Soos Date: Mon, 16 Jan 2023 08:58:44 +0100 Subject: [PATCH 2/3] Use tag 1.4 --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c131f95..968451f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,7 +3,7 @@ name: Publish to pub.dev ## Caller of this workflow should use it as follows: ## jobs: ## publish: -## uses: dart-lang/setup-dart/.github/workflows/publish.yml +## uses: dart-lang/setup-dart/.github/workflows/publish.yml@1.4 ## # with: ## # working-directory: path/to/sub/directory @@ -30,7 +30,7 @@ jobs: # Checkout repository - uses: actions/checkout@v3 # Setup Dart SDK with JWT token - - uses: dart-lang/setup-dart@main + - uses: dart-lang/setup-dart@1.4 # Minimal package setup and dry run checks. - name: Install dependencies run: dart pub get From 9699345cfb9cec2316cae3b4af0f706376f73cf2 Mon Sep 17 00:00:00 2001 From: Istvan Soos Date: Mon, 16 Jan 2023 09:02:01 +0100 Subject: [PATCH 3/3] Use commit hash instead --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 968451f..fb55d87 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,7 +3,7 @@ name: Publish to pub.dev ## Caller of this workflow should use it as follows: ## jobs: ## publish: -## uses: dart-lang/setup-dart/.github/workflows/publish.yml@1.4 +## uses: dart-lang/setup-dart/.github/workflows/publish.yml@main [or a recent commit hash / version tag] ## # with: ## # working-directory: path/to/sub/directory @@ -30,7 +30,7 @@ jobs: # Checkout repository - uses: actions/checkout@v3 # Setup Dart SDK with JWT token - - uses: dart-lang/setup-dart@1.4 + - uses: dart-lang/setup-dart@7b1734b5b08d53fbf347cf96b664fa1a49cc6497 # Minimal package setup and dry run checks. - name: Install dependencies run: dart pub get