Update README.md with deprecation notice #19
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: Build Layer ZIP | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
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 "::set-output name=sharp_version::$sharp_version" | |
release_exists="true" | |
git show-ref --tags --quiet --verify -- "refs/tags/$sharp_version" || release_exists="false" | |
echo "::set-output name=release_exists::$release_exists" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
# platforms: linux/amd64,linux/arm64 | |
tags: amazon-linux-sharp-layer:dev | |
# this action should be replaced with load: true in the docker_build action, see https://github.com/docker/buildx/issues/59 | |
- name: Load Docker images | |
run: | | |
docker buildx build --load --platform linux/amd64 -t amazon-linux-sharp-layer:dev-x86_64 . && | |
# docker buildx build --load --platform linux/arm64 -t amazon-linux-sharp-layer:dev-aarch64 . && | |
echo 'done' | |
- name: Copy artifacts x86_64 | |
run: docker run --platform linux/amd64 -v "${{ github.workspace }}/dist-x86_64":/dist amazon-linux-sharp-layer:dev-x86_64 | |
# - name: Copy artifacts aarch64 | |
# run: docker run --platform linux/arm64 -v "${{ github.workspace }}/dist-aarch64":/dist amazon-linux-sharp-layer:dev-aarch64 | |
- name: Upload artifacts x86_64 | |
uses: actions/upload-artifact@v2 | |
with: | |
name: sharp-lambda-layer.x86_64.zip | |
path: dist-x86_64/sharp-lambda-layer.zip | |
if-no-files-found: error | |
# - name: Upload artifacts aarch64 | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: sharp-lambda-layer.aarch64.zip | |
# path: dist-aarch64/sharp-lambda-layer.zip | |
# if-no-files-found: error | |
- name: Create release | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.vars.outputs.release_exists == 'false' }} | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.vars.outputs.sharp_version }} | |
release_name: Version ${{ steps.vars.outputs.sharp_version }} | |
prerelease: ${{ contains(steps.vars.outputs.sharp_version, '-') }} | |
- name: Upload release asset x86_64 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.vars.outputs.release_exists == 'false' }} | |
id: upload_release_asset_x86_64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist-x86_64/sharp-lambda-layer.zip | |
asset_name: sharp-lambda-layer.x86_64.zip | |
asset_content_type: application/zip | |
# - name: Upload release asset aarch64 | |
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.vars.outputs.release_exists == 'false' }} | |
# id: upload_release_asset_aarch64 | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: dist/sharp-layer.aarch64.zip | |
# asset_name: sharp-lambda-layer.aarch64.zip | |
# asset_content_type: application/zip |