Skip to content

Create Tag and Publish to pub.dev #44

Create Tag and Publish to pub.dev

Create Tag and Publish to pub.dev #44

Workflow file for this run

name: Create Tag and Publish to pub.dev
on:
workflow_run:
workflows: ["Trigger Create Tag and Publish Workflow on PR Merge"]
types:
- completed
jobs:
placeholder-job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Placeholder Step
run: echo "This is a placeholder job"
# call-check-version:
# uses: ./.github/workflows/check_version.yml
# secrets:
# TRIGGER_NEXT_ACTION: ${{ secrets.TRIGGER_NEXT_ACTION }}
# call-trigger-create-tag-and-publish:
# uses: ./.github/workflows/trigger_on_pr_merge.yml
# secrets:
# TRIGGER_CREATE_TAG_AND_PUBLISH: ${{ secrets.TRIGGER_CREATE_TAG_AND_PUBLISH }}
# debug:
# runs-on: ubuntu-latest
# steps:
# - name: Debug
# run: |
# echo "TRIGGER_NEXT_ACTION: $TRIGGER_NEXT_ACTION"
# echo "if condition: ${{ needs.call-check-version.outputs.TRIGGER_NEXT_ACTION == 'true' }}"
# env:
# TRIGGER_NEXT_ACTION: ${{ needs.call-check-version.outputs.TRIGGER_NEXT_ACTION }}
create-tag-and-publish:
permissions:
repository-projects: write
packages: write
contents: read
pull-requests: write
runs-on: ubuntu-latest
needs: [placeholder-job]
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