Create Tag and Publish to pub.dev #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Tag and Publish to pub.dev | ||
on: | ||
workflow_run: | ||
workflows: ["Trigger Create Tag and Publish Workflow on PR Merge", "Check Version"] | ||
types: | ||
- completed | ||
jobs: | ||
placeholder-job: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Placeholder Step | ||
run: echo "This is a placeholder job" | ||
create-tag-and-publish: | ||
permissions: | ||
repository-projects: write | ||
packages: write | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
needs: [placeholder-job, trigger_next_action, trigger_create_tag_and_publish] | ||
if: env.TRIGGER_NEXT_ACTION == 'true' && env.TRIGGER_CREATE_TAG_AND_PUBLISH == 'true' | ||
Check failure on line 27 in .github/workflows/create_tag.yml GitHub Actions / Create Tag and Publish to pub.devInvalid workflow file
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Get version | ||
id: yq | ||
uses: mikefarah/yq@master | ||
with: | ||
cmd: yq -r '.version' 'pubspec.yaml' | ||
- name: Print version | ||
run: echo ${{ steps.yq.outputs.result }} | ||
- name: Create tag | ||
uses: actions/github-script@v3 | ||
id: tagCreate | ||
env: | ||
TAG: 'v${{ steps.yq.outputs.result }}' | ||
with: | ||
github-token: ${{ github.token }} | ||
script: | | ||
github.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: "refs/tags/v${{ steps.yq.outputs.result }}", | ||
sha: context.sha | ||
}) | ||
- name: Print tag update | ||
run: echo ${{ steps.tagCreate.outputs.result }} | ||
- name: Publish | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
channel: 'stable' | ||
- name: Flutter Version | ||
run: flutter --version | ||
- name: Publish to Dart Package | ||
uses: k-paxian/dart-package-publisher@v1.5.1 | ||
with: | ||
credentialJson: ${{ secrets.CREDENTIAL_JSON }} | ||
flutter: true | ||
skipTests: true |