From 5aa7e65336232555362ba90ece17de5bf96b1808 Mon Sep 17 00:00:00 2001 From: emi~ Date: Sun, 12 Nov 2023 22:17:31 -0300 Subject: [PATCH] ci: the more you try the worse it gets --- .github/workflows/main.yml | 56 ++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9427458..d14d872 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,45 +8,53 @@ on: workflow_dispatch: jobs: - pre-release: - name: "Release" + build-and-release: + name: "Build and Release" runs-on: ubuntu-latest + strategy: + matrix: + branch: [master, standalone] + steps: - - name: "Checkout Master Branch" + - name: "Checkout Code" uses: actions/checkout@v3 with: - ref: 'master' + ref: ${{ matrix.branch }} - - name: "Build Master" + - name: "Prepare Build" run: | ver=$(sed -n "s|^versionCode=||p" module.prop) + echo "VERSION_CODE=$ver" >> $GITHUB_ENV name=$(sed -n "s|^name=||p" module.prop | sed "s| |-|g") newVersion=$(echo $ver | sed 's|\(.\)\(.\)\(.\)|\1.\2.\3|') - zip -r "${name}-${newVersion}.zip" . -x ".git/*" "LICENSE" "build.sh" ".gitignore" "*.zip" - echo "Made ${name}-${newVersion} ($ver)" - mv "${name}-${newVersion}.zip" "eMagisk-full-${ver}.zip" + zipName="${name}-${newVersion}-${{ matrix.branch }}.zip" + echo "ZIP_NAME=$zipName" >> $GITHUB_ENV - - name: "Checkout Standalone Branch" - uses: actions/checkout@v3 + - name: "Build ZIP" + run: | + zip -r "${{ env.ZIP_NAME }}" . -x ".git/*" "LICENSE" "build.sh" ".gitignore" "*.zip" + echo "Built ${{ env.ZIP_NAME }}" + + - name: "Upload ZIP to Artifacts" + uses: actions/upload-artifact@v2 with: - ref: 'standalone' + name: ${{ env.ZIP_NAME }} + path: ${{ env.ZIP_NAME }} - - name: "Build Standalone" - run: | - ver=$(sed -n "s|^versionCode=||p" module.prop) - name=$(sed -n "s|^name=||p" module.prop | sed "s| |-|g") - newVersion=$(echo $ver | sed 's|\(.\)\(.\)\(.\)|\1.\2.\3|') - zip -r "${name}-${newVersion}.zip" . -x ".git/*" "LICENSE" "build.sh" ".gitignore" "*.zip" - echo "Made ${name}-${newVersion} ($ver)" - mv "${name}-${newVersion}.zip" "eMagisk-noatlas-${ver}.zip" + create-release: + needs: build-and-release + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v2 + with: + path: zips/ - - uses: "marvinpinto/action-automatic-releases@latest" + - name: "Create GitHub Release" + uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: "latest" prerelease: true - title: "Latest Release v${{ env.MASTER_VERSION_CODE }} & v${{ env.STANDALONE_VERSION_CODE }}" + title: "Latest Release" files: | - eMagisk-full-${{ env.MASTER_VERSION_CODE }}.zip - eMagisk-noatlas-${{ env.STANDALONE_VERSION_CODE }}.zip - + zips/*.zip