Skip to content

feat: native wayland support #244

feat: native wayland support

feat: native wayland support #244

name: 📦 Promote to stable
on:
issue_comment:
types:
- created
permissions:
issues: write
env:
SNAP_NAME: ${{ github.event.repository.name }}
jobs:
promote:
environment: "Candidate Branch"
runs-on: ubuntu-latest
if: |
( !github.event.issue.pull_request )
&& contains(github.event.comment.body, '/promote ')
&& contains(github.event.*.labels.*.name, 'testing')
steps:
- id: command
uses: xt0rted/slash-command-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: promote
reaction: "true"
reaction-type: "eyes"
allow-edits: "false"
permission-level: write
- id: promote
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_STABLE }}
run: |
echo "The command was '${{ steps.command.outputs.command-name }}' with arguments '${{ steps.command.outputs.command-arguments }}'"
arguments=(${{ steps.command.outputs.command-arguments }})
revision=${arguments[0]}
channel=${arguments[1]}
done=${arguments[2]}
# Validation checks
re='^[0-9]+([,][0-9]+)*$'
if [[ ! "$revision" =~ $re ]]; then
echo "revision must be a number or a comma seperated list of numbers, not '$revision'!"
exit 1
fi
if [[ "$channel" != "stable" ]]; then
echo "I can only promote to stable, not '$channel'!"
exit 1
fi
if [[ -n "$done" && "$done" != "done" ]]; then
echo "The third argument should be 'done' or empty"
exit 1
fi
# Install Snapcraft
sudo snap install --classic snapcraft
sudo chown root:root /
# 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 "revisions=${released_revs[@]}" >> $GITHUB_OUTPUT
echo "channel=$channel" >> $GITHUB_OUTPUT
echo "done=$done" >> $GITHUB_OUTPUT
- uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'The following revisions were released to the `${{ steps.promote.outputs.channel }}` channel: `${{ steps.promote.outputs.revisions }}`'
})
if ("${{ steps.promote.outputs.done }}" === "done") {
github.rest.issues.update({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed'
})
}