-
Notifications
You must be signed in to change notification settings - Fork 1
34 lines (32 loc) · 1.03 KB
/
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
name: Snap build
on:
push:
branches: [ main ]
jobs:
snap:
name: Build and create snap
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Create version
id: version
run: echo "version=$(grep ^version pubspec.yaml |cut -f 2 -d ' '|cut -f 1 -d '+')" >> $GITHUB_OUTPUT
- name: Get HEAD short sha
id: short_sha
run: echo "short_sha=$(echo ${{ github.sha }}|head -c 7)" >> $GITHUB_OUTPUT
shell: bash
- name: set HEAD git short sha in config.dart
run: sed -i "/commit/s/HEAD/${{ steps.short_sha.outputs.short_sha }}/" lib/config.dart
shell: bash
- uses: snapcore/action-build@v1
id: snapcraft
- name: Create a release in GitHub
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: ${{ steps.snapcraft.outputs.snap }}
token: "${{ secrets.GH_TOKEN }}"
tag: "v${{ steps.version.outputs.version }}"
commit: "${{ github.sha }}"