-
Notifications
You must be signed in to change notification settings - Fork 11
88 lines (82 loc) · 3.25 KB
/
release_snap.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
# Usage documentation: release_snap.md
on:
workflow_call:
inputs:
channel:
description: Snap Store channel to release to
required: true
type: string
artifact-prefix:
description: |
Prefix for snap package GitHub artifact(s)
Use canonical/data-platform-workflows build_snap.yaml to build the snap(s)
required: true
type: string
path-to-snap-project-directory:
description: |
Relative path to snap project directory from repository directory
The "snap project directory" is the directory that contains the `snap` directory, not the `snap` directory itself.
default: .
type: string
create-github-release:
description: Create git tag(s) & GitHub release
default: true
type: boolean
snapcraft-snap-revision:
description: snapcraft snap revision
required: false
type: string
snapcraft-snap-channel:
description: |
snapcraft snap channel
Cannot be used if `snapcraft-snap-revision` input is passed
required: false
type: string
secrets:
snap-store-token:
description: Snap Store login token
required: true
jobs:
release-snap:
name: Release snap
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Get workflow version
id: workflow-version
uses: canonical/get-workflow-version-action@v1
with:
repository-name: canonical/data-platform-workflows
file-name: release_snap.yaml
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install CLI
run: pipx install git+https://github.com/canonical/data-platform-workflows@'${{ steps.workflow-version.outputs.sha }}'#subdirectory=python/cli
- name: Parse snapcraft version inputs
id: snapcraft-snap-version
run: parse-snap-version --revision='${{ inputs.snapcraft-snap-revision }}' --channel='${{ inputs.snapcraft-snap-channel }}' --revision-input-name=snapcraft-snap-revision --channel-input-name=snapcraft-snap-channel
- name: Install snapcraft
run: sudo snap install snapcraft --classic ${{ steps.snapcraft-snap-version.outputs.install_flag }}
- run: snap list
- name: Checkout
uses: actions/checkout@v4
- name: Download snap package(s)
uses: actions/download-artifact@v4
with:
pattern: ${{ inputs.artifact-prefix }}-*
merge-multiple: true
- name: Upload & release snap
id: release
run: release-snap --directory='${{ inputs.path-to-snap-project-directory }}' --channel='${{ inputs.channel }}' --create-release='${{ inputs.create-github-release }}'
env:
SNAPCRAFT_STORE_AUTH: candid
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.snap-store-token }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload snapcraft logs
if: ${{ failure() && steps.release.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: logs-snapcraft-release-${{ inputs.artifact-prefix }}
path: ~/.local/state/snapcraft/log/
if-no-files-found: ignore