Skip to content

Commit

Permalink
ci: prepare for promotion/PRs on seperate branches (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsgruk committed Feb 23, 2024
1 parent 4e231e0 commit d879fcd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/promote-to-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,37 @@ permissions:
issues: write

jobs:
promote:
name: ⬆️ Promote to stable
promote-latest:
name: ⬆️ Promote to latest/stable
environment: "Candidate Branch"
runs-on: ubuntu-latest
if: |
( !github.event.issue.pull_request )
&& contains(github.event.comment.body, '/promote ')
&& contains(github.event.comment.body, 'latest/stable')
&& contains(github.event.issue.body, 'latest/stable')
&& contains(github.event.*.labels.*.name, 'testing')
steps:
- name: ⬆️ Promote to stable
- name: ⬆️ Promote to latest/stable
uses: snapcrafters/ci/promote-to-stable@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
store-token: ${{ secrets.SNAP_STORE_STABLE }}
snapcraft-channel: 7.x/stable

promote-dev:
name: ⬆️ Promote to dev/stable
environment: "Dev Branch"
runs-on: ubuntu-latest
if: |
( !github.event.issue.pull_request )
&& contains(github.event.comment.body, '/promote ')
&& contains(github.event.comment.body, 'dev/stable')
&& contains(github.event.issue.body, 'dev/stable')
&& contains(github.event.*.labels.*.name, 'testing')
steps:
- name: ⬆️ Promote to dev/stable
uses: snapcrafters/ci/promote-to-stable@main
with:
channel: dev/stable
github-token: ${{ secrets.GITHUB_TOKEN }}
store-token: ${{ secrets.SNAP_STORE_STABLE }}
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Pull Request

on:
pull_request:
branches: ["**"]
branches: ["candidate"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/sync-upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Update
on:
# Runs at 10:00 UTC every day
schedule:
- cron: '0 10 * * *'
- cron: "0 10 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand All @@ -24,10 +24,17 @@ jobs:
update-script: |
stable_version="$(curl -sL https://www.sublimemerge.com/download | grep -Po '<p class="latest"><i>Version:</i> Build \K[0-9]+')"
sed -i 's/^\(version: \).*$/\1'"\"$stable_version\""'/' snap/snapcraft.yaml
# Support for dev will be added later
# dev_version="$(curl -sL https://www.sublimemerge.com/dev | grep -Po '<p class="latest"><i>Version:</i> Build \K[0-9]+')"
# if [[ "$stable_version" > "$dev_version" ]]; then
# yq -i ".version = \"$stable_version\"" snap/snapcraft.yaml
# else
# yq -i ".version = \"$dev_version-dev\"" snap/snapcraft.yaml
# fi
sync-dev:
name: Sync dev version with upstream
environment: "Dev Branch"
runs-on: ubuntu-latest
steps:
- name: Sync version with upstream
uses: snapcrafters/ci/sync-version@main
with:
branch: dev
token: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }}
update-script: |
dev_version="$(curl -sL https://www.sublimemerge.com/dev | grep -Po '<p class="latest"><i>Version:</i> Build \K[0-9]+')"
sed -i 's/^\(version: \).*$/\1'"\"$dev_version\""'/' snap/snapcraft.yaml

0 comments on commit d879fcd

Please sign in to comment.