Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: automatically bump node parts and use remote build #181

Merged
merged 8 commits into from
Nov 13, 2023
12 changes: 10 additions & 2 deletions .github/testing-issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
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

```shell
snap refresh {{ env.SNAP_NAME }} --{{ env.CHANNEL }}
```

Maintainers can promote this to stable by commenting `/promote <revision-number> stable`.
Maintainers can promote this to stable by commenting `/promote <rev>[,<rev>] 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`.
20 changes: 13 additions & 7 deletions .github/workflows/snap-store-promote-to-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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,
Expand Down
53 changes: 47 additions & 6 deletions .github/workflows/snap-store-publish-to-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
secrets:
SNAP_STORE_CANDIDATE:
required: true
LP_BUILD_SECRET:
required: true

# Permissions for GITHUB_TOKEN
permissions:
Expand All @@ -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 "[email protected]"
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:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/sync-version-with-upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-snap-can-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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