From ab13f94cf0987c38835c872b721312ad01fc8c8c Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 31 Oct 2024 13:21:34 +0000 Subject: [PATCH 1/6] Add github action to build snap. --- .github/workflows/snap.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/snap.yml diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml new file mode 100644 index 000000000..ce3683ed9 --- /dev/null +++ b/.github/workflows/snap.yml @@ -0,0 +1,31 @@ +name: SDRangel snap release build + +on: + push: + branches: + - snap + tags: + - 'v*' + pull_request: + +jobs: + build_snap: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + - name: Install Snapcraft + uses: samuelmeuli/action-snapcraft@v2 + - name: Build snap + run: | + snapcraft + - name: Get version + id: get_version + run: echo "version=$(echo ${{github.ref_name}} | cut -c2-)" >> $env:GITHUB_OUTPUT + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: sdrangel-${{ steps.get_version.outputs.version }}-amd64.snap + path: ${{ github.workspace }}/sdrangel_${{ steps.get_version.outputs.version }}_amd64.snap From 5ac77fca9875e1a278abc618d1cfa791dcc875ec Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 31 Oct 2024 13:31:05 +0000 Subject: [PATCH 2/6] Try snapcore/action-build instead --- .github/workflows/snap.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index ce3683ed9..3063138a7 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -1,3 +1,4 @@ +# See: https://github.com/snapcore/action-build name: SDRangel snap release build on: @@ -16,11 +17,7 @@ jobs: with: submodules: true fetch-depth: 0 - - name: Install Snapcraft - uses: samuelmeuli/action-snapcraft@v2 - - name: Build snap - run: | - snapcraft + - uses: snapcore/action-build@v1 - name: Get version id: get_version run: echo "version=$(echo ${{github.ref_name}} | cut -c2-)" >> $env:GITHUB_OUTPUT @@ -28,4 +25,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: sdrangel-${{ steps.get_version.outputs.version }}-amd64.snap - path: ${{ github.workspace }}/sdrangel_${{ steps.get_version.outputs.version }}_amd64.snap + path: ${{ steps.snapcraft.outputs.snap }} From 729d663832e0c47418499fbe43a2912365970f1c Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 31 Oct 2024 14:38:52 +0000 Subject: [PATCH 3/6] Add id to try to fix "Input required and not supplied: path" in upload-artifact --- .github/workflows/snap.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index 3063138a7..237626017 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -18,6 +18,7 @@ jobs: submodules: true fetch-depth: 0 - uses: snapcore/action-build@v1 + id: snapcraft - name: Get version id: get_version run: echo "version=$(echo ${{github.ref_name}} | cut -c2-)" >> $env:GITHUB_OUTPUT From ede06e2ca87c8697279f9fc6c3871faf1e0823e9 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 31 Oct 2024 16:05:50 +0000 Subject: [PATCH 4/6] Fix version name. --- .github/workflows/snap.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index 237626017..4cf82f584 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -17,11 +17,16 @@ jobs: with: submodules: true fetch-depth: 0 - - uses: snapcore/action-build@v1 - id: snapcraft - name: Get version id: get_version - run: echo "version=$(echo ${{github.ref_name}} | cut -c2-)" >> $env:GITHUB_OUTPUT + run: | + if [[ "${{github.ref_name}" == "snap" ]]; then + echo "version=${{github.sha}}" >> $GITHUB_OUTPUT + else + echo "version=$(echo ${{github.ref_name}} | cut -c2-)" >> $GITHUB_OUTPUT + fi + - uses: snapcore/action-build@v1 + id: snapcraft - name: Upload artifact uses: actions/upload-artifact@v3 with: From 4d6d97538c1e5e32976a1754cb2e307c6e197463 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 31 Oct 2024 16:07:48 +0000 Subject: [PATCH 5/6] Fix syntax --- .github/workflows/snap.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index 4cf82f584..a1e094fb6 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -20,7 +20,7 @@ jobs: - name: Get version id: get_version run: | - if [[ "${{github.ref_name}" == "snap" ]]; then + if [[ "${{github.ref_name}}" == "snap" ]]; then echo "version=${{github.sha}}" >> $GITHUB_OUTPUT else echo "version=$(echo ${{github.ref_name}} | cut -c2-)" >> $GITHUB_OUTPUT From fa4f9c2d82c002ff080b90dcecd10b0f2006a84e Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Fri, 1 Nov 2024 12:21:59 +0000 Subject: [PATCH 6/6] Update snap to github releases and snap store. --- .github/workflows/snap.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index a1e094fb6..82334142d 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -26,9 +26,20 @@ jobs: echo "version=$(echo ${{github.ref_name}} | cut -c2-)" >> $GITHUB_OUTPUT fi - uses: snapcore/action-build@v1 - id: snapcraft + id: build - name: Upload artifact uses: actions/upload-artifact@v3 with: name: sdrangel-${{ steps.get_version.outputs.version }}-amd64.snap - path: ${{ steps.snapcraft.outputs.snap }} + path: ${{ steps.build.outputs.snap }} + - name: Upload release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + with: + files: ${{ steps.build.outputs.snap }} + - uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }} + with: + snap: ${{ steps.build.outputs.snap }} + release: stable