-
-
Notifications
You must be signed in to change notification settings - Fork 2
137 lines (115 loc) · 4.02 KB
/
release.yml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Attach files to release and upload to PPA
on:
release:
types:
- published
permissions:
id-token: write
attestations: write
contents: write
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: 🏷️ Check tag name
run: |
echo "::group::Checking tag name"
tag="${{ github.ref_name }}"
echo "$tag" | grep -Pq "^v\d+\.\d+\.\d+$" || (echo "Error: Tag name '$tag' does not correct." && exit 1)
echo "::endgroup::"
- name: 📥 Clone repository
uses: actions/checkout@v4.1.2
- name: ⚙️ Install dependencies
# Temporary disable packages caching feature.
# uses: awalsh128/cache-apt-pkgs-action@latest
# with:
# packages: devscripts dput debhelper
# version: 1.0
run: |
echo "::group::Installing dependencies"
sudo apt-get install devscripts dput debhelper -y
echo "::endgroup::"
- name: 🔐 Set up GPG key
# GPG key for signing deb packages
run: |
echo "${{ secrets.PPA_GPG_KEY }}" | gpg --allow-secret-key-import --import --batch --yes
- name: 🛠️ Build .deb package
run: |
EMAIL="81070564+okineadev@users.noreply.github.com"
FULLNAME="Okinea Dev"
# GPG key to use
key="2783259A7535F745"
# Get version from tag
tag="${{ github.ref_name }}"
release_version=$(echo "$tag" | sed 's/v//g')
changes="You can view the changes at this link - https://github.com/okineadev/dotload/releases/tag/$tag"
# ugly syntax
echo "::group::Building deb-package"
make deb-package ARGS=" \
--workflow \
--version '$release_version' \
--fullname '$FULLNAME' \
--email '$EMAIL' \
--changes '$changes' \
--passphrase '${{ secrets.PPA_GPG_KEY_PASSPHRASE }}' \
--key '$key'"
echo "::endgroup::"
- name: 🛠️ Build Snap package
run: |
# Install `lxd`
echo "::group::Installing `lxd`"
sudo iptables -P FORWARD ACCEPT
sudo snap install snapcraft --classic
sudo usermod -aG lxd $USER
sudo snap run lxd init --auto
sudo snap run lxd waitready
# Login
export SNAPCRAFT_STORE_CREDENTIALS="${{ secrets.SNAPCRAFT_CREDENTIALS }}"
# Get version from tag
echo "::group::Get version from tag"
tag="${{ github.ref_name }}"
release_version=$(echo "$tag" | sed 's/v//g')
echo "::endgroup::"
# Build snap package
echo "::group::Building snap package"
make snap-package ARGS="--workflow --version '$release_version'"
echo "::endgroup::"
- name: ✅ Attest artifacts
uses: github-early-access/generate-build-provenance@main
# Read: https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
with:
subject-path: |
dotload/bin/dotload
dotload_*.deb
dotload_*.snap
- name: ⬆️ Upload files to release
uses: softprops/action-gh-release@v1
with:
files: |
dotload/bin/dotload
dotload_*.deb
dotload_*.snap
dotload_*.dsc
dotload_*.tar.xz
- name: 📦 Upload package to Ubuntu PPA
continue-on-error: true
run: |
echo "::group::Uploading deb-package to Ubuntu PPA"
dput ppa:salumin/tools dotload_*_source.changes
echo "::endgroup::"
- name: 📦 Upload package to Snap Store
continue-on-error: true
run: |
# Login
export SNAPCRAFT_STORE_CREDENTIALS="${{ secrets.SNAPCRAFT_CREDENTIALS }}"
echo "::group::Uploading snap-package to Snap Store"
snapcraft upload --release=stable dotload_*_all.snap
echo "::endgroup::"
- name: 🧹 Clean
run: |
echo "### Done! :rocket:" >> $GITHUB_STEP_SUMMARY
echo "::group::Cleaning"
make clean
echo "::endgroup::"