@@ -3,69 +3,53 @@ name: Build Layer ZIP
3
3
on :
4
4
push :
5
5
branches :
6
- -master
6
+ -master
7
7
pull_request :
8
8
branches :
9
- -master
9
+ -master
10
10
11
11
jobs :
12
12
build :
13
13
runs-on :ubuntu-latest
14
14
steps :
15
- -name :Checkout
16
- uses :actions/checkout@v2
17
- with :
18
- fetch-depth :0
19
- -name :Read version
20
- id :package_lock_json
21
- run :|
22
- content=$(cat ./package-lock.json)
23
- content="${content//'%'/'%25'}"
24
- content="${content//$'\n'/'%0A'}"
25
- content="${content//$'\r'/'%0D'}"
26
- echo "::set-output name=packageLockJson::$content"
27
- -name :Variables
28
- id :vars
29
- run :|
30
- sharp_version="${{ fromJSON(steps.package_lock_json.outputs.packageLockJson).dependencies.sharp.version }}"
31
- echo "::set-output name=sharp_version::$sharp_version"
15
+ -name :Checkout
16
+ uses :actions/checkout@v2
17
+ with :
18
+ fetch-depth :0
19
+ -name :Read version
20
+ id :package_lock_json
21
+ run :|
22
+ content=$(cat ./package-lock.json)
23
+ content="${content//'%'/'%25'}"
24
+ content="${content//$'\n'/'%0A'}"
25
+ content="${content//$'\r'/'%0D'}"
26
+ echo "::set-output name=packageLockJson::$content"
27
+ -name :Variables
28
+ id :vars
29
+ run :|
30
+ sharp_version="${{ fromJSON(steps.package_lock_json.outputs.packageLockJson).dependencies.sharp.version }}"
31
+ echo "::set-output name=sharp_version::$sharp_version"
32
32
33
- release_exists="true"
34
- git show-ref --tags --quiet --verify -- "refs/tags/$sharp_version" || release_exists="false"
35
- echo "::set-output name=release_exists::$release_exists"
36
- -name :Build
37
- id :docker_build
38
- uses :docker/build-push-action@v2
39
- with :
40
- context :.
41
- file :./Dockerfile
42
- tags :amazon-linux-sharp-layer:dev
43
- -name :Copy artifacts
44
- run :docker run -v "${{ github.workspace }}/dist":/dist amazon-linux-sharp-layer:dev
45
- -name :Upload artifacts
46
- uses :actions/upload-artifact@v2
47
- with :
48
- name :sharp-lambda-layer.zip
49
- path :dist/sharp-layer.zip
50
- if-no-files-found :error
51
- -name :Create release
52
- if :${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.vars.outputs.release_exists == 'false' }}
53
- id :create_release
54
- uses :actions/create-release@v1
55
- env :
56
- GITHUB_TOKEN :${{ secrets.GITHUB_TOKEN }}
57
- with :
58
- tag_name :${{ steps.vars.outputs.sharp_version }}
59
- release_name :Version ${{ steps.vars.outputs.sharp_version }}
60
- prerelease :${{ contains(steps.vars.outputs.sharp_version, '-') }}
61
- -name :Upload release asset
62
- if :${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
63
- id :upload_release_asset
64
- uses :actions/upload-release-asset@v1
65
- env :
66
- GITHUB_TOKEN :${{ secrets.GITHUB_TOKEN }}
67
- with :
68
- upload_url :${{ steps.create_release.outputs.upload_url }}
69
- asset_path :dist/sharp-layer.zip
70
- asset_name :sharp-lambda-layer.zip
71
- asset_content_type :application/zip
33
+ release_exists="true"
34
+ git show-ref --tags --quiet --verify -- "refs/tags/$sharp_version" || release_exists="false"
35
+ echo "::set-output name=release_exists::$release_exists"
36
+ -name :Build
37
+ id :docker_build
38
+ uses :docker/build-push-action@v2
39
+ with :
40
+ context :.
41
+ file :./Dockerfile
42
+ tags :amazon-linux-sharp-layer:dev
43
+ -name :Copy artifacts
44
+ run :docker run -v "${{ github.workspace }}/dist":/dist amazon-linux-sharp-layer:dev
45
+ -name :Upload artifacts
46
+ uses :actions/upload-artifact@v2
47
+ with :
48
+ name :sharp-lambda-layer.zip
49
+ path :dist/sharp-layer.zip
50
+ if-no-files-found :error
51
+ -name :Create release
52
+ uses :softprops/action-gh-release@v1
53
+ with :
54
+ tag_name :${{ steps.vars.outputs.sharp_version }}
55
+ files :dist/sharp-layer.zip