Skip to content

Commit

Permalink
Bump version to 1.9.2 and enable auto version update (#16)
Browse files Browse the repository at this point in the history
* auto update

* fix

* fix

* update

* improve

* fix

* fix

* fix

* fix

* improve

* remove trigger on push

* fix

* fix

* improve

* fix update version

* Update to version v1.9.2 (#15)

Co-authored-by: boyan01 <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
boyan01 and github-actions[bot] authored Jul 26, 2024
1 parent c155d0e commit 8ce34a4
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 7 deletions.
55 changes: 50 additions & 5 deletions .github/workflows/update-from-upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,57 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- id: upstream
uses: pozetroninc/github-action-get-latest-release@master
- uses: actions/setup-node@v4
with:
repository: MixinNetwork/flutter-app
node-version: 20

- name: fetch latest release tag from upstream repo
id: fetch_release
uses: actions/github-script@v7
with:
script: |
const owner = 'MixinNetwork';
const repo = 'flutter-app';
const { data: latestRelease } = await github.rest.repos.getLatestRelease({owner, repo});
core.setOutput('tag_name', latestRelease.tag_name);
- name: check has upgrade
id: check_upgrade
run: |
current_version=$(grep -oP "(?<=https://github.com/MixinNetwork/flutter-app/releases/download/).*(?=/mixin_desktop_linux_amd64_portable.tar.gz)" one.mixin.messenger.yml)
echo "current version: $current_version, remote version: ${{ steps.fetch_release.outputs.tag_name }}"
if [ "$current_version" != "${{ steps.fetch_release.outputs.tag_name }}" ]; then
echo "new version available"
echo "new_version=${{ steps.fetch_release.outputs.tag_name }}" >> $GITHUB_ENV
echo "current_version=$current_version" >> $GITHUB_ENV
wget https://github.com/MixinNetwork/flutter-app/releases/download/${{ steps.fetch_release.outputs.tag_name }}/mixin_desktop_linux_amd64_portable.tar.gz -O mixin_desktop_linux_amd64_portable.tar.gz
new_version_sha256=$(sha256sum mixin_desktop_linux_amd64_portable.tar.gz | cut -d' ' -f1)
echo "new_version_sha256=$new_version_sha256" >> $GITHUB_ENV
else
echo "no new version available"
exit 0
fi

- name: Update version
if: env.new_version
run: |
current_version=$(cat one.mixin.messenger.yml | grep -oP "(?<=https://github.com/MixinNetwork/flutter-app/releases/download/).*(?=/mixin_desktop_linux_amd64_portable.tar.gz)")
echo "current version: $current_version}, remote version: ${steps.upstream.outputs.release}"
sed -i -e 's/${{ env.current_version }}/${{ env.new_version }}/g' one.mixin.messenger.yml
sed -i -e 's/sha256:.*/sha256: ${{ env.new_version_sha256 }}/g' one.mixin.messenger.yml
CURRENT_DATE=$(date '+%Y-%-m-%-d')
VERSION=$(echo ${{ env.new_version }} | cut -d 'v' -f2)
sed -i "/<releases>/a\ <release version=\"${VERSION}\" date=\"$CURRENT_DATE\" />" one.mixin.messenger.metainfo.xml
- name: Create Pull Request
if: env.new_version
uses: peter-evans/create-pull-request@v6
with:
add-paths: |
one.mixin.messenger.yml
one.mixin.messenger.metainfo.xml
token: ${{ secrets.GITHUB_TOKEN }}
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
commit-message: Update to version ${{ env.new_version }}
branch: update-version-${{ env.new_version }}
title: Update to version ${{ env.new_version }}
body: This PR updates the version to https://github.com/MixinNetwork/flutter-app/releases/tag/${{ env.new_version }}.
1 change: 1 addition & 0 deletions one.mixin.messenger.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
</screenshots>
<content_rating type="oars-1.1" />
<releases>
<release version="1.9.2" date="2024-7-26" />
<release version="1.9.0" date="2024-7-13" />
<release version="1.1.1" date="2023-12-18" />
<release version="0.39.2" date="2023-3-28" />
Expand Down
4 changes: 2 additions & 2 deletions one.mixin.messenger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ modules:
path: mixin_desktop.png
- type: archive
archive-type: tar
url: https://github.com/MixinNetwork/flutter-app/releases/download/v1.9.0/mixin_desktop_linux_amd64_portable.tar.gz
sha256: f1b3ce8ea6f285947115fb7c66a8f6917f6f512cbaca0ea441974d61371c9769
url: https://github.com/MixinNetwork/flutter-app/releases/download/v1.9.2/mixin_desktop_linux_amd64_portable.tar.gz
sha256: 84e218d0960fbb9daa90a3a119748b0356c14fffead92176b299f7689b7c01db
- type: file
path: one.mixin.messenger.metainfo.xml

0 comments on commit 8ce34a4

Please sign in to comment.