diff --git a/.github/testing-issue-template.md b/.github/testing-issue-template.md index e27cddfff..7deb291ee 100644 --- a/.github/testing-issue-template.md +++ b/.github/testing-issue-template.md @@ -2,7 +2,10 @@ title: Call for testing `{{ env.SNAP_NAME }}` labels: testing --- -A new version of `{{ env.SNAP_NAME }}` was just pushed to the `{{ env.CHANNEL }}` channel [in the snap store](https://snapcraft.io/{{ env.SNAP_NAME }}). Please test it and add a comment to state whether everything works or not. + +A new version of `{{ env.SNAP_NAME }}` was just pushed to the `{{ env.CHANNEL }}` channel [in the +snap store](https://snapcraft.io/{{ env.SNAP_NAME }}). Please test it and add a comment to state +whether everything works or not. You can upgrade to this version by running @@ -10,4 +13,9 @@ You can upgrade to this version by running snap refresh {{ env.SNAP_NAME }} --{{ env.CHANNEL }} ``` -Maintainers can promote this to stable by commenting `/promote stable`. +Maintainers can promote this to stable by commenting `/promote [,] stable`. + +The `/promote` command must be issued with at least one revision and a channel, for example +`/promote 34 stable`. Multiple revisions can also be promoted at once where required (this is +useful where there are new arm64 and amd64 revisions at the same time), for example `/promote 34,35 +stable`. diff --git a/.github/workflows/snap-store-promote-to-stable.yml b/.github/workflows/snap-store-promote-to-stable.yml index afb8e53b1..86eba971a 100644 --- a/.github/workflows/snap-store-promote-to-stable.yml +++ b/.github/workflows/snap-store-promote-to-stable.yml @@ -38,10 +38,10 @@ jobs: revision=${arguments[0]} channel=${arguments[1]} - # Sanity checks - re='^[0-9]+$' + # Validation checks + re='^[0-9]+([,][0-9]+)*$' if [[ ! "$revision" =~ $re ]]; then - echo "revision must be a number, not '$revision'!" + echo "revision must be a number or a comma seperated list of numbers, not '$revision'!" exit 1 fi if [[ "$channel" != "stable" ]]; then @@ -53,10 +53,16 @@ jobs: sudo snap install --classic snapcraft sudo chown root:root / - # Release - snapcraft release $SNAP_NAME "$revision" "$channel" + # Iterate over each specified revision and release + revs=$(echo $revision | tr "," "\n") + released_revs=() + + for r in $revs; do + snapcraft release $SNAP_NAME "$r" "$channel" + released_revs+="$r" + done - echo "revision=$revision" >> $GITHUB_OUTPUT + echo "revisions=${released_revs[@]}" >> $GITHUB_OUTPUT echo "channel=$channel" >> $GITHUB_OUTPUT - uses: actions/github-script@v6 with: @@ -65,7 +71,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: 'Great, revision `${{ steps.promote.outputs.revision }}` version is now in `${{ steps.promote.outputs.channel }}`!' + body: 'The following revisions were released to the `${{ steps.promote.outputs.channel }}` channel: `${{ steps.promote.outputs.revisions }}`' }) github.rest.issues.update({ issue_number: context.issue.number, diff --git a/.github/workflows/snap-store-publish-to-candidate.yml b/.github/workflows/snap-store-publish-to-candidate.yml index fef9b0819..b68f30d89 100644 --- a/.github/workflows/snap-store-publish-to-candidate.yml +++ b/.github/workflows/snap-store-publish-to-candidate.yml @@ -11,6 +11,8 @@ on: secrets: SNAP_STORE_CANDIDATE: required: true + LP_BUILD_SECRET: + required: true # Permissions for GITHUB_TOKEN permissions: @@ -29,20 +31,59 @@ jobs: environment: "Candidate Branch" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout the source + uses: actions/checkout@v3 with: ref: ${{ env.CHANNEL }} - - uses: snapcore/action-build@v1 + + - name: Setup snapcraft + env: + LP_BUILD_SECRET: ${{ secrets.LP_BUILD_SECRET }} + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_CANDIDATE }} + run: | + sudo snap install snapcraft --classic + + # Setup Launchpad credentials + mkdir -p ~/.local/share/snapcraft/provider/launchpad + echo "$LP_BUILD_SECRET" > ~/.local/share/snapcraft/provider/launchpad/credentials + git config --global user.email "github-actions@github.com" + git config --global user.name "Github Actions" + + - name: Remote build the snap id: build - - uses: diddlesnaps/snapcraft-review-action@v1 + run : | + snapcraft remote-build --launchpad-accept-public-upload + + version="$(cat snap/snapcraft.yaml | yq -r '.version')" + echo "{amd64_snap}={signal_desktop_$version_amd64.snap}" >> "$GITHUB_OUTPUT" + echo "{arm64_snap}={signal_desktop_$version_arm64.snap}" >> "$GITHUB_OUTPUT" + + - name: Review the built amd64 snap + uses: diddlesnaps/snapcraft-review-action@v1 with: - snap: ${{ steps.build.outputs.snap }} + snap: ${{ steps.build.outputs.amd64_snap }} isClassic: 'false' - - uses: snapcore/action-publish@v1 + + - name: Review the built arm64 snap + uses: diddlesnaps/snapcraft-review-action@v1 + with: + snap: ${{ steps.build.outputs.arm64_snap }} + isClassic: 'false' + + - name: Publish the amd64 snap + uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_CANDIDATE }} + with: + snap: ${{ steps.build.outputs.amd64_snap }} + release: ${{ env.CHANNEL }} + + - name: Publish the arm64 snap + uses: snapcore/action-publish@v1 env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_CANDIDATE }} with: - snap: ${{ steps.build.outputs.snap }} + snap: ${{ steps.build.outputs.arm64_snap }} release: ${{ env.CHANNEL }} create_issue: diff --git a/.github/workflows/sync-version-with-upstream.yml b/.github/workflows/sync-version-with-upstream.yml index fb3d32686..83c394cd1 100644 --- a/.github/workflows/sync-version-with-upstream.yml +++ b/.github/workflows/sync-version-with-upstream.yml @@ -24,6 +24,17 @@ jobs: jq . | grep tag_name | grep -v beta | head -n 1 | cut -d'"' -f4 | tr -d 'v' ) sed -i 's/^\(version: \).*$/\1'"$VERSION"'/' snap/snapcraft.yaml + + # Fetch the upstream package.json for the fetched version + wget -qO package.json https://raw.githubusercontent.com/signalapp/Signal-Desktop/v${VERSION}/package.json + + # Update the @signalapp/ringrtc version if required + export RINGRTC_VERSION="$(cat package.json | jq -r '.dependencies."@signalapp/ringrtc"')" + sed -i -E "s|ringrtc-[0-9]+\.[0-9]+\.[0-9]+\.tgz|ringrtc-${RINGRTC_VERSION}.tgz|" snap/snapcraft.yaml + + # Update the @signalapp/bettersqlite version if required + BETTERSQLITE_VERSION="$(cat package.json | jq -r '.dependencies."@signalapp/better-sqlite3"')" + sed -i -E "s|better-sqlite3-[0-9]+\.[0-9]+\.[0-9]+\.tgz|better-sqlite3-${BETTERSQLITE_VERSION}.tgz|" snap/snapcraft.yaml - name: Check for modified files id: git-check run: | diff --git a/.github/workflows/test-snap-can-build.yml b/.github/workflows/test-snap-can-build.yml index 94d4e6419..63c8025a4 100644 --- a/.github/workflows/test-snap-can-build.yml +++ b/.github/workflows/test-snap-can-build.yml @@ -24,4 +24,4 @@ jobs: isClassic: 'false' # Plugs and Slots declarations to override default denial (requires store assertion to publish) # plugs: ./plug-declaration.json - # slots: ./slot-declaration.json + # slots: ./slot-declaration.json \ No newline at end of file