diff options
| author | TrainDoctor <traindoctor@protonmail.com> | 2022-09-04 20:00:53 -0700 |
|---|---|---|
| committer | TrainDoctor <traindoctor@protonmail.com> | 2022-09-04 20:04:11 -0700 |
| commit | d2da85460d7de81b39e93662b018f889be5646dc (patch) | |
| tree | 558ed07a07f053cd8735e8b410e3598fd0e884d8 | |
| parent | 5f469bfb1628ffe17eb7921359682d6b24e380c4 (diff) | |
| download | decky-loader-d2da85460d7de81b39e93662b018f889be5646dc.tar.gz decky-loader-d2da85460d7de81b39e93662b018f889be5646dc.zip | |
Update CI to accommodate custom version bumps
| -rw-r--r-- | .github/workflows/build.yml | 112 | ||||
| -rw-r--r-- | act/prerelease.json | 3 | ||||
| -rw-r--r-- | act/release.json | 3 | ||||
| -rwxr-xr-x | act/run-act.sh | 1 |
4 files changed, 99 insertions, 20 deletions
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 📤 diff --git a/act/prerelease.json b/act/prerelease.json index 4ef0e8c7..6e9f4f81 100644 --- a/act/prerelease.json +++ b/act/prerelease.json @@ -1,5 +1,6 @@ { "inputs": { - "release": "prerelease" + "release": "prerelease", + "bump": "none" } }
\ No newline at end of file diff --git a/act/release.json b/act/release.json index fe400521..2f39ae7f 100644 --- a/act/release.json +++ b/act/release.json @@ -1,5 +1,6 @@ { "inputs": { - "release": "release" + "release": "release", + "bump": "none" } }
\ No newline at end of file diff --git a/act/run-act.sh b/act/run-act.sh index 71a3d40c..63b325a4 100755 --- a/act/run-act.sh +++ b/act/run-act.sh @@ -1,6 +1,7 @@ #!/bin/bash type=$1 +# bump=$2 oldartifactsdir="old" |
