-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new release and promote workflow (#402)
Using official actions directly. --------- Co-authored-by: Xuhui Zhu <[email protected]> Co-authored-by: Andrea Ieri <[email protected]>
- Loading branch information
1 parent
8d93d0d
commit 96ded85
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Promote snap to other tracks and channels | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
destination-channel: | ||
description: 'Destination Channel, e.g. latest/candidate' | ||
required: true | ||
origin-channel: | ||
description: 'Origin Channel, e.g. latest/edge' | ||
required: true | ||
|
||
jobs: | ||
promote-snap: | ||
name: Promote snap | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Snapcraft install | ||
run: sudo snap install --classic snapcraft | ||
- name: Get snap name | ||
id: snap | ||
run: awk '/^name:/ {print $2}' snap/snapcraft.yaml >> $GITHUB_OUTPUT | ||
- name: Snapcraft promote snap | ||
env: | ||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | ||
SNAPCRAFT_HAS_TTY: "true" # this is necessary because snapcraft will not allow --yes for promotions of the edge channel https://github.com/canonical/snapcraft/issues/4439 | ||
run: | | ||
# Note: using `yes |` instead of `--yes` because snapcraft will | ||
# refuse to non-interactively promote a snap from the edge | ||
# channel if it is done without any branch qualifiers | ||
yes | snapcraft promote ${{ steps.snap.outputs.name }} \ | ||
--from-channel ${{ github.event.inputs.origin-channel }} \ | ||
--to-channel ${{ github.event.inputs.destination-channel }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Publish snap | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
check: | ||
uses: ./.github/workflows/check.yaml | ||
secrets: inherit | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: check | ||
outputs: | ||
snap: ${{ steps.build.outputs.snap }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: snapcore/action-build@v1 | ||
id: build | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: snap | ||
path: ${{ steps.build.outputs.snap }} | ||
- uses: snapcore/action-publish@v1 | ||
env: | ||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | ||
with: | ||
snap: ${{ steps.build.outputs.snap }} | ||
release: latest/edge |