Skip to content

Workflow file for this run

name: Package Publish
on:
push:
branches: [ master, release ]
jobs:
check_version:
name: "Check Version Tag"
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Get Latest Version Tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@master
- name: Print Latest Version
run: echo "Latest tag: ${{ steps.previoustag.outputs.tag }}"

Check failure on line 20 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

You have an error in your yaml syntax on line 20
- name: Get Version from pubspec.yaml
id: config
uses: CumulusDS/[email protected]
with:
file: pubspec.yaml
version_name: version
- name: Print New Version
run: echo "New version from pubspec.yaml: ${{ steps.config.outputs.version_name }}"
- name: Compare Version
if: steps.config.outputs.version_name == steps.previoustag.outputs.tag
run: |
echo 'The version from pubspec.yaml is the same as the latest release tag. Please update the version.'
exit 1
- name: Save New Version
run: echo "${{ steps.config.outputs.version_name }}" > version.txt
- name: Upload New Version Artifact
uses: actions/upload-artifact@v4
with:
name: version
path: version.txt
publish:
needs: check_version
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: stable
- name: Set Pub Credentials
run: echo "${{ secrets.CREDENTIAL_JSON }}" > ~/.pub-cache/credentials.json
- name: Verify Pub Credentials File
run: |
if [ -f ~/.pub-cache/credentials.json ]; then
echo "Credentials file exists."
else
echo "Credentials file not found!" && exit 1
fi
- name: Publish Package to Pub
run: flutter pub publish --force
tag:
name: "Tag Version"
needs: publish
runs-on: ubuntu-20.04
steps:
- name: Download New Version
uses: actions/download-artifact@v4
with:
name: version
- name: Read and Tag New Version
run: |
NEW_VERSION=$(cat version/version.txt)
echo "Tagging version: $NEW_VERSION"
git tag $NEW_VERSION
git push origin $NEW_VERSION