From d2da85460d7de81b39e93662b018f889be5646dc Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 4 Sep 2022 20:00:53 -0700 Subject: Update CI to accommodate custom version bumps --- .github/workflows/build.yml | 112 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 94 insertions(+), 18 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 458943f2..9eca53e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,15 @@ on: - none - prerelease - release + bump: + type: choice + description: Semver to bump + default: 'none' + options: + - none + - patch + - minor + - major permissions: contents: write @@ -66,29 +75,90 @@ jobs: with: path: ./dist/PluginLoader + # release: + # name: Release the package + # if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'release' }} + # needs: build + # runs-on: ubuntu-latest + + # steps: + # - name: Checkout 🧰 + # uses: actions/checkout@v3 + + # - name: Fetch package artifact ⬇️ + # uses: actions/download-artifact@v3 + # with: + # name: PluginLoader + # path: dist + + # - name: Release 📦 + # uses: softprops/action-gh-release@v1 + # if: ${{ !env.ACT }} + # with: + # name: Release ${{ steps.tag_version.outputs.new_tag }} + # tag_name: ${{ steps.tag_version.outputs.new_tag }} + # files: ./dist/PluginLoader + # generate_release_notes: true + release: - name: Release the package + name: Release stable version of the package if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'release' }} needs: build runs-on: ubuntu-latest steps: - - name: Checkout 🧰 - uses: actions/checkout@v3 + - name: Install semver-tool asdf + uses: asdf-vm/actions/install@v1 + with: + tool_versions: | + semver 3.3.0 - name: Fetch package artifact ⬇️ uses: actions/download-artifact@v3 + if: ${{ !env.ACT }} with: name: PluginLoader path: dist + - name: Get latest release + uses: rez0n/actions-github-release@main + id: latest_release + env: + token: ${{ secrets.GITHUB_TOKEN }} + # repository: "SteamDeckHomebrew/decky-loader" + repository: "TrainDoctor/decky-loader" + type: "nodraft" + + - name: Prepare tag ⚙️ + id: ready_tag + run: | + export VERSION=${{ steps.latest_release.outputs.release }} + echo "VERS: $VERSION" + if [[ "$VERSION" =~ "-pre" ]]; then + OUT=$(semver bump release "$VERSION") + elif [[ ! "$VERSION" =~ "-pre" ]]; then + if [[ "${{github.event.inputs.bump}}" != "none" ]]; then + OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION") + fi + fi + echo "OUT: v$OUT" + echo ::set-output name=tag_name::v$OUT + + - name: Push tag 📤 + uses: rickstaa/action-create-tag@v1.3.2 + if: ${{ steps.ready_tag.outputs.tag_name && github.event_name == 'workflow_dispatch' && !env.ACT }} + with: + tag: ${{ steps.ready_tag.outputs.tag_name }} + message: Pre-release ${{ steps.ready_tag.outputs.tag_name }} + - name: Release 📦 uses: softprops/action-gh-release@v1 - if: ${{ !env.ACT }} + if: ${{ github.event_name == 'workflow_dispatch' && !env.ACT }} with: - name: Release ${{ steps.tag_version.outputs.new_tag }} - tag_name: ${{ steps.tag_version.outputs.new_tag }} + name: Prerelease ${{ steps.ready_tag.outputs.tag_name }} + tag_name: ${{ steps.ready_tag.outputs.tag_name }} files: ./dist/PluginLoader + prerelease: false generate_release_notes: true prerelease: @@ -104,30 +174,36 @@ jobs: tool_versions: | semver 3.3.0 - - name: Checkout 🧰 - uses: actions/checkout@v3 - - name: Fetch package artifact ⬇️ uses: actions/download-artifact@v3 + if: ${{ !env.ACT }} with: name: PluginLoader path: dist - - name: Get tag 🏷️ - id: old_tag - uses: rafarlopes/get-latest-pre-release-tag-action@v1 + - name: Get latest release + uses: rez0n/actions-github-release@main + id: latest_release env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - repository: 'decky-loader' + token: ${{ secrets.GITHUB_TOKEN }} + repository: "SteamDeckHomebrew/decky-loader" + type: "nodraft" - name: Prepare tag ⚙️ id: ready_tag run: | - export VERSION=${{ steps.old_tag.outputs.tag }} + export VERSION=${{ steps.latest_release.outputs.release }} echo "VERS: $VERSION" - OUT=$(semver bump prerel "$VERSION") - echo "OUT: $OUT" + if [[ ! "$VERSION" =~ "-pre" ]]; then + OUT=$(semver bump minor "$VERSION") + OUT="$OUT-pre" + elif [[ "$VERSION" =~ "-pre" ]]; then + if [[ "${{github.event.inputs.bump}}" != "none" ]]; then + OUT=$(semver bump ${{github.event.inputs.bump}} "$OUT") + fi + fi + OUT=$(semver bump prerel "$OUT") + echo "OUT: v$OUT" echo ::set-output name=tag_name::v$OUT - name: Push tag 📤 -- cgit v1.2.3 From b35bd056d5389cf796279ef1b2676783c6036a81 Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 4 Sep 2022 20:11:06 -0700 Subject: Work on bump logic --- .github/workflows/build.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9eca53e8..5f423117 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -136,9 +136,14 @@ jobs: echo "VERS: $VERSION" if [[ "$VERSION" =~ "-pre" ]]; then OUT=$(semver bump release "$VERSION") + if [[ "${{github.event.inputs.bump}}" != "none" ]]; then + OUT=$(semver bump ${{github.event.inputs.bump}} "$OUT") + fi elif [[ ! "$VERSION" =~ "-pre" ]]; then if [[ "${{github.event.inputs.bump}}" != "none" ]]; then OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION") + else + OUT=$(semver bump patch "$VERSION") fi fi echo "OUT: v$OUT" @@ -195,12 +200,10 @@ jobs: export VERSION=${{ steps.latest_release.outputs.release }} echo "VERS: $VERSION" if [[ ! "$VERSION" =~ "-pre" ]]; then - OUT=$(semver bump minor "$VERSION") OUT="$OUT-pre" - elif [[ "$VERSION" =~ "-pre" ]]; then - if [[ "${{github.event.inputs.bump}}" != "none" ]]; then - OUT=$(semver bump ${{github.event.inputs.bump}} "$OUT") - fi + fi + if [[ "${{github.event.inputs.bump}}" != "none" ]]; then + OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION") fi OUT=$(semver bump prerel "$OUT") echo "OUT: v$OUT" -- cgit v1.2.3 From 7c99af9a9a9ef1c3d0bf9dc7cca2bfad6a9f82e9 Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 4 Sep 2022 20:25:44 -0700 Subject: Add more logging and change release bump logic --- .github/workflows/build.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f423117..1df1b34d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -135,18 +135,26 @@ jobs: export VERSION=${{ steps.latest_release.outputs.release }} echo "VERS: $VERSION" if [[ "$VERSION" =~ "-pre" ]]; then + printf "is prerelease, bumping release\n" OUT=$(semver bump release "$VERSION") + printf "OUT: ${OUT}\n" if [[ "${{github.event.inputs.bump}}" != "none" ]]; then OUT=$(semver bump ${{github.event.inputs.bump}} "$OUT") + printf "OUT: ${OUT}\n" fi elif [[ ! "$VERSION" =~ "-pre" ]]; then + printf "is a release, bumping as selected\n" if [[ "${{github.event.inputs.bump}}" != "none" ]]; then OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION") + printf "OUT: ${OUT}\n" else + printf "none bump selected, but cannot have identical tag\n" + printf "bumping patch\n" OUT=$(semver bump patch "$VERSION") + printf "OUT: ${OUT}\n" fi fi - echo "OUT: v$OUT" + echo "vOUT: v$OUT" echo ::set-output name=tag_name::v$OUT - name: Push tag 📤 @@ -199,11 +207,15 @@ jobs: run: | export VERSION=${{ steps.latest_release.outputs.release }} echo "VERS: $VERSION" - if [[ ! "$VERSION" =~ "-pre" ]]; then - OUT="$OUT-pre" - fi if [[ "${{github.event.inputs.bump}}" != "none" ]]; then + OUT=$(semver bump release "$VERSION") + printf "OUT: ${OUT}\n" OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION") + printf "OUT: ${OUT}\n" + fi + if [[ ! "$OUT" =~ "-pre" ]]; then + OUT="$OUT-pre" + printf "OUT: ${OUT}\n" fi OUT=$(semver bump prerel "$OUT") echo "OUT: v$OUT" -- cgit v1.2.3 From 97f95705f8ba971608d5c723a50839a591e21eb4 Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 4 Sep 2022 20:36:03 -0700 Subject: Fix pre-release, none --- .github/workflows/build.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1df1b34d..813d22ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -210,14 +210,18 @@ jobs: if [[ "${{github.event.inputs.bump}}" != "none" ]]; then OUT=$(semver bump release "$VERSION") printf "OUT: ${OUT}\n" - OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION") + OUT=$(semver bump ${{github.event.inputs.bump}} "$OUT") printf "OUT: ${OUT}\n" fi if [[ ! "$OUT" =~ "-pre" ]]; then - OUT="$OUT-pre" + OUT="${OUT}-pre" printf "OUT: ${OUT}\n" fi - OUT=$(semver bump prerel "$OUT") + if [[ "$OUT" == "" ]]; then + OUT=$(semver bump prerel "$VERSION") + else + OUT=$(semver bump prerel "$OUT") + fi echo "OUT: v$OUT" echo ::set-output name=tag_name::v$OUT -- cgit v1.2.3 From f5a18372279156eef0dc1e86f016aaed43c0639d Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 4 Sep 2022 20:51:16 -0700 Subject: OUT --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 813d22ee..10343575 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -134,6 +134,7 @@ jobs: run: | export VERSION=${{ steps.latest_release.outputs.release }} echo "VERS: $VERSION" + OUT="notsemver" if [[ "$VERSION" =~ "-pre" ]]; then printf "is prerelease, bumping release\n" OUT=$(semver bump release "$VERSION") @@ -207,13 +208,16 @@ jobs: run: | export VERSION=${{ steps.latest_release.outputs.release }} echo "VERS: $VERSION" + OUT="notsemver" if [[ "${{github.event.inputs.bump}}" != "none" ]]; then + printf "bumping by release then by selected\n" OUT=$(semver bump release "$VERSION") printf "OUT: ${OUT}\n" OUT=$(semver bump ${{github.event.inputs.bump}} "$OUT") printf "OUT: ${OUT}\n" fi if [[ ! "$OUT" =~ "-pre" ]]; then + printf "appending -pre to new prerelease\n" OUT="${OUT}-pre" printf "OUT: ${OUT}\n" fi -- cgit v1.2.3 From 18924030446e7ea971d55677ff604df414aa4e1c Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 4 Sep 2022 20:56:38 -0700 Subject: better equivalency checking --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10343575..6c429e37 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,11 @@ jobs: runs-on: ubuntu-latest steps: + - name: Print input + run : | + echo "release: ${{ github.event.inputs.release }}\n" + echo "bump: ${{ github.event.inputs.bump }}\n" + - name: Checkout 🧰 uses: actions/checkout@v3 @@ -209,7 +214,7 @@ jobs: export VERSION=${{ steps.latest_release.outputs.release }} echo "VERS: $VERSION" OUT="notsemver" - if [[ "${{github.event.inputs.bump}}" != "none" ]]; then + if [[ ! ${{ github.event.inputs.bump }} == "none" ]]; then printf "bumping by release then by selected\n" OUT=$(semver bump release "$VERSION") printf "OUT: ${OUT}\n" -- cgit v1.2.3 From d1887870f5c17397befed2adac04bf2f8bfed650 Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 4 Sep 2022 21:03:45 -0700 Subject: return default value for out to "" --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c429e37..a3d4af9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -213,18 +213,18 @@ jobs: run: | export VERSION=${{ steps.latest_release.outputs.release }} echo "VERS: $VERSION" - OUT="notsemver" + OUT="" if [[ ! ${{ github.event.inputs.bump }} == "none" ]]; then printf "bumping by release then by selected\n" OUT=$(semver bump release "$VERSION") printf "OUT: ${OUT}\n" OUT=$(semver bump ${{github.event.inputs.bump}} "$OUT") printf "OUT: ${OUT}\n" - fi - if [[ ! "$OUT" =~ "-pre" ]]; then - printf "appending -pre to new prerelease\n" - OUT="${OUT}-pre" - printf "OUT: ${OUT}\n" + if [[ ! "$OUT" =~ "-pre" ]]; then + printf "appending -pre to new prerelease\n" + OUT="${OUT}-pre" + printf "OUT: ${OUT}\n" + fi fi if [[ "$OUT" == "" ]]; then OUT=$(semver bump prerel "$VERSION") -- cgit v1.2.3 From a3659ba425d922d0968c74c8f11af501cd64ff40 Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 4 Sep 2022 21:14:38 -0700 Subject: Oops I need that --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3d4af9b..b8b27056 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,6 +112,9 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout 🧰 + uses: actions/checkout@v3 + - name: Install semver-tool asdf uses: asdf-vm/actions/install@v1 with: @@ -187,6 +190,9 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout 🧰 + uses: actions/checkout@v3 + - name: Install semver-tool asdf uses: asdf-vm/actions/install@v1 with: -- cgit v1.2.3