-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (61 loc) · 2.59 KB
/
ci.yaml
File metadata and controls
69 lines (61 loc) · 2.59 KB
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
name: CI
on:
schedule:
- cron: "0 0 * * 1"
workflow_dispatch:
jobs:
checkVersion:
name: Check for new version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- id: get_version
name: Get latest version
run: |
latestVersion=$(curl -s https://api.github.com/repos/microsoft/AzureStorageExplorer/releases/latest | grep -Eo "\"tag_name\": ?\".+\"" | cut -d':' -f2 | sed -s 's/[[:space:]]//g' | sed -s 's/"//g')
if git tag --list | grep -q "${latestVersion}"; then
echo "No new version found"
echo "nextVersion=" >> "$GITHUB_OUTPUT"
else
echo "New version \"${latestVersion}\" found"
echo "nextVersion=${latestVersion}" >> "$GITHUB_OUTPUT"
fi
outputs:
nextVersion: ${{ steps.get_version.outputs.nextVersion }}
buildPackage:
name: Build debian package
runs-on: ubuntu-latest
needs: checkVersion
if: ${{ needs.checkVersion.outputs.nextVersion != '' }}
env:
UPSTREAM_VERSION: ${{ needs.checkVersion.outputs.nextVersion }}
steps:
- uses: actions/checkout@v6
- name: Download tarball from GitHub release
run: |
asset="StorageExplorer-linux-x64.tar.gz"
url="https://github.com/microsoft/AzureStorageExplorer/releases/download/${UPSTREAM_VERSION}/${asset}"
echo "Downloading ${url}"
curl -fsSL "$url" -o azure-storage-explorer.tar.gz
- name: Build the debian package
run: ./create-deb.sh -f azure-storage-explorer.tar.gz
- name: Get package version
id: get_package_version
run: |
version=$(dpkg-deb -I azure-storage-explorer_*_x64.deb | grep -Eo "Version: .*" | cut -d':' -f2 | tr -d ' ')
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Create release notes
run: |
release_url="https://github.com/microsoft/AzureStorageExplorer/releases/tag/${UPSTREAM_VERSION}"
{
printf '# Azure Storage Explorer %s\n\n' "$UPSTREAM_VERSION"
printf 'This is an automated release of Azure Storage Explorer version %s packaged as a Debian package.\n\n' "$UPSTREAM_VERSION"
printf 'Upstream release notes: %s\n' "$release_url"
} > release-notes.md
- uses: "softprops/action-gh-release@v2"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
name: "${{ steps.get_package_version.outputs.version }}"
tag_name: "${{ steps.get_package_version.outputs.version }}"
body_path: release-notes.md
files: azure-storage-explorer_*_x64.deb