6.11.2 #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main | |
on: | |
push: | |
paths: | |
- 'imei.sh' | |
- 'versions/*' | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
workflow_dispatch: | |
inputs: | |
im_version: | |
default: "" | |
description: "ImageMagick Version" | |
jobs: | |
ShellCheck: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Run Shellcheck | |
uses: azohra/[email protected] | |
with: | |
path: 'imei.sh' | |
TestBuild: | |
needs: ShellCheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Pre-Cleanup | |
env: | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
run: |- | |
sudo apt remove "*imagemagick*" --purge -y | |
sudo apt autoremove --purge -y | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: git curl make cmake automake libtool yasm g++ pkg-config perl libde265-dev libx265-dev libltdl-dev libopenjp2-7-dev liblcms2-dev libbrotli-dev libzip-dev libbz2-dev liblqr-1-0-dev libzstd-dev libgif-dev libjpeg-dev libopenexr-dev libpng-dev libwebp-dev librsvg2-dev libwmf-dev libxml2-dev libxml2 libtiff-dev libraw-dev ghostscript gsfonts ffmpeg libpango1.0-dev libdjvulibre-dev libfftw3-dev libgs-dev libgraphviz-dev | |
version: 1.0 | |
- name: Build | |
env: | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
run: |- | |
INPUT=${{ github.event.inputs.im_version }} | |
IM_VERSION=${INPUT:-""} | |
sudo bash imei.sh --ci --im-version "$IM_VERSION" --log-file "/build.log" | |
identify -version | |
[[ "$(identify -version)" == *"heic"* ]] && [[ "$(identify -version)" == *"jxl"* ]] && echo "Test build OK" || (echo "Test build FAILED" && exit 1) | |
- name: On failure | |
if: ${{ failure() }} | |
run: cat /build.log | |
Sign: | |
needs: TestBuild | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Sign release | |
env: | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
run: |- | |
echo "$PRIVATE_KEY" > private.pem | |
openssl dgst -sha512 -sign private.pem -out imei.sh.sig imei.sh | |
rm private.pem | |
- name: Verify release | |
run: |- | |
openssl dgst -sha512 -verify imei.sh.pem -signature imei.sh.sig imei.sh | |
- name: Commit and push on changes | |
run: |- | |
git add . | |
git diff | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git commit -m "Updated signature" -a || echo "No changes to commit" | |
git push | |
CreateRelease: | |
needs: Sign | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Check if version differs | |
id: version-check | |
run: | | |
LATEST_VERSION=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | jq -r .tag_name) | |
THIS_VERSION=$(grep -oP 'Version\s*:\s*\K[0-9.]+' imei.sh) | |
echo "Latest version: $LATEST_VERSION" | |
echo "This version: $THIS_VERSION" | |
if [[ "$LATEST_VERSION" != "$THIS_VERSION" ]]; then | |
echo "RELEASE_NEEDED=true" >> $GITHUB_OUTPUT | |
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_OUTPUT | |
echo "THIS_VERSION=$THIS_VERSION" >> $GITHUB_OUTPUT | |
else | |
echo "RELEASE_NEEDED=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Create Release | |
id: create-release | |
if: steps.version-check.outputs.RELEASE_NEEDED == 'true' | |
run: | | |
LATEST_VERSION="${{ steps.version-check.outputs.LATEST_VERSION }}" | |
THIS_VERSION="${{ steps.version-check.outputs.THIS_VERSION }}" | |
RELEASE_BODY="**Full Changelog**: https://github.com/${{ github.repository }}/compare/$LATEST_VERSION...$THIS_VERSION" | |
echo "Creating release $THIS_VERSION..." | |
echo "Tagging commit..." | |
git tag $THIS_VERSION | |
git push --tag | |
echo "Creating release..." | |
response=$(curl -s --data "{\"tag_name\": \"$THIS_VERSION\", \"name\": \"$THIS_VERSION\", \"body\": \"$RELEASE_BODY\"}" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases") |