test6 #32
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: 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 }}" | |
- 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 previous tag, please update the version" | |
exit 1 | |
- name: Save New Version | |
run: "echo ${{ steps.config.outputs.version_name }} > version.txt" | |
- name: Upload New Version | |
uses: actions/upload-artifact@v4 | |
with: | |
name: home | |
path: version.txt | |
publish: | |
needs: | |
- check_version | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Publish Package | |
uses: Omega365/actions-flutter-pub-publisher@master | |
with: | |
credential: "${{ secrets.CREDENTIAL_JSON }}" | |
dry_run: false | |
flutter_package: true | |
skip_test: true | |
tag: | |
name: "Tag Version" | |
needs: | |
- publish | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Download New Version | |
uses: actions/download-artifact@v4 | |
with: | |
name: home | |
- name: Set and Tag the New Version | |
run: | | |
echo "RELEASE_VERSION=$(cat home/version.txt)" >> $GITHUB_ENV | |
shell: bash | |
- name: Create New Tag | |
uses: tvdias/[email protected] | |
with: | |
repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
tag: "${{ env.RELEASE_VERSION }}" |