From 56063a8b44d34c7be864b1f751cf82e876001a3d Mon Sep 17 00:00:00 2001 From: "Daniel W. Steinbrook" Date: Thu, 7 Aug 2025 21:03:52 -0400 Subject: [PATCH 1/4] Add snap config and GitHub Action --- .github/workflows/snap.yml | 25 +++++++++++++++++++++++++ .gitignore | 3 +++ snap/snapcraft.yaml | 27 +++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 .github/workflows/snap.yml create mode 100644 snap/snapcraft.yaml diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml new file mode 100644 index 0000000000..10fde51f36 --- /dev/null +++ b/.github/workflows/snap.yml @@ -0,0 +1,25 @@ +name: Build and publish snap +on: + workflow_dispatch: + push: + branches: + - master + tags: + - "lychee-v*" + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: snapcore/action-build@v1 + #TODO set up credential for publishing (see https://github.com/snapcore/action-publish) + #- uses: snapcore/action-publish@v1 + # env: + # SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} + # with: + # snap: ${{ steps.build.outputs.snap }} + # release: edge diff --git a/.gitignore b/.gitignore index 62e9da5e86..e546bd2d9b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ Thumbs.db /target/ debug/ +# Generated by snapcraft +*.snap + # NOTE: Cargo.lock should be committed for workspaces with both binaries and libraries # Cargo.lock diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 0000000000..bb97920199 --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,27 @@ +name: lychee +summary: Fast, async, stream-based link checker written in Rust +description: | + Finds broken hyperlinks and mail addresses, supports Markdown, HTML + and more, simple and lightweight + +website: https://lychee.cli.rs/ +issues: https://github.com/lycheeverse/lychee/issues +source-code: https://github.com/lycheeverse/lychee +license: Apache-2.0 OR MIT + +version: "0.19.1" + +grade: stable +confinement: strict +base: core24 + +parts: + lychee: + plugin: rust + source: . + build-packages: + - libssl-dev + +apps: + lychee: + command: lychee From 4d49f61d107770109f9e0117bf9c94a77376c1f9 Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Fri, 8 Aug 2025 14:33:19 +0200 Subject: [PATCH 2/4] Add publish step (added credentials) --- .github/workflows/snap.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index 10fde51f36..ed8ccce343 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -16,10 +16,9 @@ jobs: steps: - uses: actions/checkout@v4 - uses: snapcore/action-build@v1 - #TODO set up credential for publishing (see https://github.com/snapcore/action-publish) - #- uses: snapcore/action-publish@v1 - # env: - # SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} - # with: - # snap: ${{ steps.build.outputs.snap }} - # release: edge + - uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} + with: + snap: ${{ steps.build.outputs.snap }} + release: edge From 465d5094c3983d8ee9a84e1920270962f26c6ff9 Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Fri, 8 Aug 2025 14:36:49 +0200 Subject: [PATCH 3/4] Update snap.yml --- .github/workflows/snap.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index ed8ccce343..d88d81280f 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -8,7 +8,8 @@ on: - "lychee-v*" pull_request: branches: - - master + # - master + - "**" # Temporarily enable on push to PR. Remove before merging to `master` jobs: build: From 6da6f3d4cb816cfdd21ffd80be130d9a4df84ffd Mon Sep 17 00:00:00 2001 From: "Daniel W. Steinbrook" Date: Fri, 8 Aug 2025 18:01:04 -0400 Subject: [PATCH 4/4] Selectively publish edge and stable snaps --- .github/workflows/snap.yml | 9 +++------ snap/snapcraft.yaml | 5 ++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index d88d81280f..8382d11964 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -1,4 +1,4 @@ -name: Build and publish snap +name: Snap on: workflow_dispatch: push: @@ -6,13 +6,10 @@ on: - master tags: - "lychee-v*" - pull_request: - branches: - # - master - - "**" # Temporarily enable on push to PR. Remove before merging to `master` jobs: build: + if: startsWith(github.ref, 'refs/tags/lychee-v') runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -22,4 +19,4 @@ jobs: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} with: snap: ${{ steps.build.outputs.snap }} - release: edge + release: ${{ startsWith(github.ref, 'refs/tags/lychee-v') && 'stable' || 'edge'}} diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index bb97920199..81a7996bd2 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -9,7 +9,7 @@ issues: https://github.com/lycheeverse/lychee/issues source-code: https://github.com/lycheeverse/lychee license: Apache-2.0 OR MIT -version: "0.19.1" +adopt-info: lychee # set version automatically from git tag grade: stable confinement: strict @@ -21,6 +21,9 @@ parts: source: . build-packages: - libssl-dev + override-pull: | + craftctl default + craftctl set version=$(git describe --tags --abbrev=10) apps: lychee: