summaryrefslogtreecommitdiff
path: root/.github/workflows/main.yml
blob: 5bfa2ad0d91fa3493df91f4d6120e3a8696dc1e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: "release"

on:
  workflow_dispatch:
    inputs:
      bump:
        type: choice
        description: Semver to bump
        default: 'none'
        options:
          - none
          - patch
          - minor
          - major

permissions:
  contents: write


jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Print input
        run : |
          echo "bump: ${{ github.event.inputs.bump }}\n"

      - 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: Get latest release
        uses: rez0n/actions-github-release@main
        id: latest_release
        env:
          token: ${{ secrets.GITHUB_TOKEN }}
          repository: "SteamDeckHomebrew/decky-installer"
          type: "nodraft"

      - name: Prepare tag ⚙️
        id: ready_tag
        run: |
          export VERSION=${{ steps.latest_release.outputs.release }}
          echo "VERS: $VERSION"
          OUT="notsemver"
          if [[ "${{github.event.inputs.bump}}" != "none" ]]; then
              OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION")
              printf "OUT: ${OUT}\n"
          else
            printf "no bump selected. Defaulting to a patch bump.\n"
            OUT=$(semver bump patch "$VERSION")
            printf "OUT: ${OUT}\n"
          fi
          echo "vOUT: v$OUT"
          echo tag_name=v$OUT >> $GITHUB_OUTPUT
          
      - 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: ${{ github.event_name == 'workflow_dispatch' && !env.ACT  }}
        with:
          name: Version ${{ steps.ready_tag.outputs.tag_name }}
          tag_name: ${{ steps.ready_tag.outputs.tag_name }}
          files: |
            ${{ github.workspace }}/gui/decky_installer.desktop
            ${{ github.workspace }}/gui/user_install_script.sh
            ${{ github.workspace }}/cli/install_prerelease.sh
            ${{ github.workspace }}/cli/install_release.sh
            ${{ github.workspace }}/cli/uninstall.sh
          prerelease: false
          generate_release_notes: true
          draft: true