From 9adb664682a2efd126265477ae61fe537c2fd552 Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:15:18 +0200 Subject: [PATCH] Create beta-release.yaml --- .github/workflows/beta-release.yaml | 64 +++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/beta-release.yaml diff --git a/.github/workflows/beta-release.yaml b/.github/workflows/beta-release.yaml new file mode 100644 index 0000000..a946b35 --- /dev/null +++ b/.github/workflows/beta-release.yaml @@ -0,0 +1,64 @@ +# https://github.com/SilentVoid13/Templater/blob/master/.github/workflows/release.yml + +name: Plugin-beta release +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+-[0-9]+-beta" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout beta branch + uses: actions/checkout@v3 + with: + ref: beta + + - name: Fetch main branch + run: git fetch origin main + + - name: Checkout main branch + run: git checkout main + + - name: Extract version from tag + id: extract_version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Strip -beta from version + run: | + VERSION=${{ env.VERSION }} + RELEASE_VERSION=${VERSION%-beta} + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV + + - name: Update manifest-beta.json + run: | + VERSION=${{ env.VERSION }} + jq --arg version "$VERSION" '.version = $version' manifest-beta.json > manifest-beta-temp.json + mv manifest-beta-temp.json manifest-beta.json + + - name: Commit and push changes + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add manifest-beta.json + git commit -m "Update manifest-beta.json to version $VERSION" + git push origin main + + - name: npm build + run: | + npm install + npm run build --if-present + + - name: Set Release Name + run: echo "RELEASE_NAME=${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV + + - name: Create Plugin beta release + uses: ncipollo/release-action@v1.12.0 + with: + name: Beta release ${{ env.RELEASE_NAME }} + prerelease: true + artifacts: "main.js,manifest.json,styles.css" + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ env.VERSION }}