-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (90 loc) · 3.57 KB
/
nodejs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- run: npm ci
# this will create fresh install in puppeteer-chromium
- run: npm install puppeteer
- run: chmod -R +x puppeteer-chromium
# Moving puppeteer-chromium back to default cache folder
- run: npm install -g typescript
- run: tsc
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ vars.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: puppeteer-lambda
IMAGE_TAG: puppeteer_lambda
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# - name: Login to ECR
# id: ecr
# uses: elgohr/ecr-login-action@v3
# with:
# access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
# secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# region: ${{ secrets.AWS_REGION }}
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# - name: Publish to Registry
# uses: elgohr/Publish-Docker-Github-Action@v5
# with:
# name: myDocker/repository
# username: ${{ steps.ecr.outputs.username }}
# password: ${{ steps.ecr.outputs.password }}
# registry: ${{ steps.ecr.outputs.registry }}
# - run: mkdir ./nodejs
# - run: mkdir ./nodejs/node_modules
# - run: mkdir ./nodejs/node_modules/puppeteer-lambda
# - run: cp ./node_modules ./nodejs/node_modules -r
# - run: cp ./package.json ./nodejs/node_modules/puppeteer-lambda/package.json
# - run: cp ./dist ./nodejs/node_modules/puppeteer-lambda/dist -r
# - run: cp ./index.js ./nodejs/node_modules/puppeteer-lambda/index.js
# - name: action-zip
# uses: montudor/[email protected]
# with:
# args: zip -qq -r package.zip nodejs
# - uses: hkusu/s3-upload-action@v2
# with:
# aws-access-key-id: "${{ secrets.AWS_ACCESS_KEY_ID }}"
# aws-secret-access-key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
# aws-region: "${{ secrets.AWS_REGION }}"
# aws-bucket: "${{ secrets.AWS_BUCKET }}"
# file-path: 'package.zip'
# bucket-root: "puppeteer-layer"
# destination-dir: "/"
# - name: default deploy
# uses: appleboy/lambda-action@master
# with:
# aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws_region: ${{ secrets.AWS_REGION }}
# s3_bucket: ${{ secrets.AWS_BUCKET }}
# function_name: ffprobe
# s3_key: "ff-lambda/package.zip"
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: "Build"
files: |
*.zip