Skip to content

CI

CI #22

Workflow file for this run

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@v3
- 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=null" >> "$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 != '' }}
steps:
- uses: actions/checkout@v3
- name: Download latest tar.gz
run: |
linkElement=$(curl -sSX GET https://azure.microsoft.com/en-us/products/storage/storage-explorer | grep -zoP '<a[^>]*href="[^"]*"[^>]*>(?:(?!</a>).)*?Linux-.tar(?:(?!</a>).)*?</a>' | tr -d '\0')
url=$(echo -n $linkElement | sed -n 's/.*href="\([^"]*\)".*/\1/p')
wget -O azure-storage-explorer.tar.gz $url
- 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"
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: "${{ steps.get_package_version.outputs.version }}"
automatic_release_tag: "${{ steps.get_package_version.outputs.version }}"
prerelease: false
files: |
azure-storage-explorer_*_x64.deb