Skip to content

Commit

Permalink
update Release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyxot committed Apr 14, 2024
1 parent 04e9ab4 commit f7486a9
Showing 1 changed file with 47 additions and 7 deletions.
54 changes: 47 additions & 7 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
description: "custom command"
default: ""
type: string
ignore_version:
description: "ignore version"
default: false
type: boolean
schedule:
- cron: '0 */3 * * *'

Expand All @@ -16,7 +20,8 @@ jobs:
runs-on: ubuntu-latest
outputs:
latest_version: ${{ steps.get.outputs.WSA_Build_Version }}
current_version: ${{ steps.get_latest_release.outputs.tag_name }}
current_version: ${{ steps.echo.outputs.tag_name }}
update: ${{ steps.echo.outputs.update }}
steps:
- name: Clone Repository
run: git clone /~https://github.com/LSPosed/MagiskOnWSALocal.git
Expand Down Expand Up @@ -45,15 +50,27 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Echo
id: echo
run: |
echo "CURRENT_VERSION=${{ steps.get_latest_release.outputs.tag_name }}"
echo "LATEST_VERSION=${{ steps.get.outputs.WSA_Build_Version }}"
if [[ ${{ steps.get_latest_release.outputs.tag_name }} != ${{ steps.get.outputs.WSA_Build_Version }} ]];then echo "Need to Update";fi
export U=false
export T=${{ steps.get_latest_release.outputs.tag_name }}
if [[ ${{ steps.get_latest_release.outputs.tag_name }} == *${{ steps.get.outputs.WSA_Build_Version }}* ]];then export U=false >> $GITHUB_OUTPUT;fi
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]];then
if [[ ${{ github.event.inputs.ignore_version }} == 'true' ]];then
export U=true >> $GITHUB_OUTPUT
export T=${{ steps.get.outputs.WSA_Build_Version }}
fi
fi
echo update=$U >> $GITHUB_OUTPUT
echo tag_name=$T >> $GITHUB_OUTPUT
if [[ $U == true ]];then echo "Need to Update";fi
build:
name: Build WSA
needs: check
if: needs.check.outputs.latest_version != needs.check.outputs.current_version
if: needs.check.outputs.update == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -65,7 +82,10 @@ jobs:
uses: actions/checkout@v4

- name: Clone Repository
run: git clone /~https://github.com/LSPosed/MagiskOnWSALocal.git
run: |
git clone /~https://github.com/LSPosed/MagiskOnWSALocal.git
cd MagiskOnWSALocal
git reset --hard 8cee0641e7da2ab159544e41dc31fb67458d6cbf
- name: Setup Python
uses: actions/setup-python@v5
Expand Down Expand Up @@ -209,7 +229,7 @@ jobs:
mv "${{ steps.name.outputs.foldername }}.zip" "$filename.zip"
- name: Remove unused artifact
uses: geekyeggo/delete-artifact@v2
uses: geekyeggo/delete-artifact@v5
with:
name: ${{ matrix.arch }}_${{ matrix.root-sol }}_${{ matrix.gapps-brand }}

Expand Down Expand Up @@ -246,6 +266,7 @@ jobs:
run: python3 scripts/ReleaseBody.py

- name: Commit
if: needs.check.outputs.current_version != needs.check.outputs.latest_version
run: |
pip3 install requests
python3 scripts/BuildHistory.py
Expand All @@ -262,17 +283,29 @@ jobs:

- run: |
mkdir release
mv output/*/*.zip release/
mv output/release_*/*.zip release/
- name: Release
if: needs.check.outputs.current_version != needs.check.outputs.latest_version
uses: ncipollo/release-action@v1
with:
allowUpdates: true
allowUpdates: false
tag: ${{ needs.check.outputs.latest_version }}
bodyFile: "Changelog.md"
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "release/*.zip"

- name: Release
if: needs.check.outputs.current_version == needs.check.outputs.latest_version
uses: ncipollo/release-action@v1
with:
allowUpdates: false
draft: true
tag: "${{ needs.check.outputs.latest_version }}-${{ github.run_id }}"
bodyFile: "Changelog.md"
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "release/*.zip"

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -284,3 +317,10 @@ jobs:
with:
name: ReleaseJson
path: builds.json

- name: Upload Artifact
if: needs.check.outputs.current_version == needs.check.outputs.latest_version
uses: actions/upload-artifact@v4
with:
name: info.json
path: output/release_*/info.json

0 comments on commit f7486a9

Please sign in to comment.