Skip to content

Build Layer ZIP

Build Layer ZIP #1130

name: Build Layer ZIP
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Read version
id: package_lock_json
run: |
content=$(cat ./package-lock.json)
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=packageLockJson::$content"
- name: Variables
id: vars
run: |
sharp_version="${{ fromJSON(steps.package_lock_json.outputs.packageLockJson).dependencies.sharp.version }}"
echo "sharp_version=$sharp_version" >> $GITHUB_OUTPUT
release_exists="true"
git show-ref --tags --quiet --verify -- "refs/tags/$sharp_version" || release_exists="false"
echo "release_exists=$release_exists" >> $GITHUB_OUTPUT
- name: Build
run: npm ci --arch=x64 --platform=linux
- name: Create release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.vars.outputs.sharp_version }}
file: dist/sharp-layer.zip
overwrite: true