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

Add new release and promote workflow #402

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/promote.yaml
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 }}
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
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,3/edge
rgildein marked this conversation as resolved.
Show resolved Hide resolved
Loading