Update push-here.md #30
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: SnapEnhanceModGen Action | |
on: | |
push: | |
paths: | |
- 'push-here.md' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Set JAVA_HOME | |
run: echo "JAVA_HOME=$(echo ${{ steps.setup-java.outputs.java-home }})" >> $GITHUB_ENV | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Get Latest Artifact URL | |
id: get_artifact | |
run: | | |
repo_owner="rhunk" | |
repo_name="SnapEnhance" | |
workflow_name="beta.yml" | |
pat="${{ secrets.SNAP_ENHANCE_WORKFLOW_ARTIFACT }}" | |
artifact_url=$(curl -s -H "Authorization: Bearer $pat" \ | |
"https://api.github.com/repos/${repo_owner}/${repo_name}/actions/workflows/${workflow_name}/runs?status=success&per_page=1" \ | |
| jq -r '.workflow_runs[0].artifacts_url') | |
download_url=$(curl -s -H "Authorization: Bearer $pat" \ | |
"$artifact_url" \ | |
| jq -r '.artifacts[0].archive_download_url') | |
echo "Artifact URL: $artifact_url" | |
echo "Download URL: $download_url" | |
echo "download_url=$download_url" >> $GITHUB_ENV | |
shell: bash | |
- name: Download Latest core.apk | |
run: | | |
download_url="${{ env.download_url }}" | |
wget "$download_url" -O "$GITHUB_WORKSPACE/core.apk" | |
- name: Run the command | |
run: | | |
java -jar lspatch.jar -m artifact/core.apk -f -l 2 -v snap.apk | |
working-directory: $GITHUB_WORKSPACE | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: snap-360-lspatched.apk | |
path: ./snap-360-lspatched.apk | |
- name: Check if the release already exists | |
id: check_release | |
run: | | |
RELEASE_VERSION=v0.0 # Change this to the initial release version | |
if curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/tags/$RELEASE_VERSION; then | |
echo "Release $RELEASE_VERSION already exists." | |
# Increment the release version | |
RELEASE_VERSION=$(echo $RELEASE_VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./') | |
fi | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Create or Update Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: snap-360-lspatched.apk | |
tag_name: ${{ env.RELEASE_VERSION }} |